Skip to content

Commit 33277be

Browse files
committed
chore(ci): add legacy-artifact publishing job
Ports the same fix from pact-foundation/pact-broker-cli: the pre-cargo-dist install.sh/action.yml fetch loose binaries named pact-<old-os>[.exe] from "latest release", but v0.10.3+ only publish cargo-dist-named archives, breaking unpinned/old-pinned consumers. This job repackages the existing cargo-dist archives under the old naming convention for 6 months, until 2027-01-01, after which it self-disables and can be deleted. Assisted-by: Claude Code:claude-sonnet-5
1 parent adebcc4 commit 33277be

3 files changed

Lines changed: 140 additions & 29 deletions

File tree

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# Publishes loose binaries under the pre-cargo-dist naming convention
2+
# (pact-<old-os>[.exe]) alongside the cargo-dist archives, so consumers
3+
# still running the old install.sh/action.yml (unpinned, or pinned to an
4+
# action tag older than v0.10.3) don't 404 when "latest release" becomes
5+
# a cargo-dist release.
6+
#
7+
# TEMPORARY: this job self-disables (no-ops) on or after 2027-01-01 and
8+
# is safe to delete after that date — remove this file, drop
9+
# "./legacy-artifacts" from post-announce-jobs and the
10+
# "legacy-artifacts" entry from github-custom-job-permissions in
11+
# Cargo.toml, then run `dist generate`.
12+
#
13+
# See pact-foundation/pact-broker-cli's
14+
# docs/superpowers/specs/2026-07-01-legacy-artifact-compat-design.md,
15+
# which this job is ported from.
16+
17+
name: Legacy Artifacts
18+
19+
permissions:
20+
contents: write
21+
22+
on:
23+
workflow_call:
24+
inputs:
25+
plan:
26+
required: true
27+
type: string
28+
workflow_dispatch:
29+
inputs:
30+
tag:
31+
description: 'Release tag to backfill legacy artifacts onto (e.g. v0.10.3)'
32+
required: true
33+
type: string
34+
35+
jobs:
36+
legacy-artifacts:
37+
name: Publish Legacy-Named Artifacts
38+
runs-on: ubuntu-latest
39+
steps:
40+
- name: Resolve tag
41+
id: version
42+
env:
43+
PLAN: ${{ inputs.plan }}
44+
MANUAL_TAG: ${{ inputs.tag }}
45+
run: |
46+
if [[ -n "$PLAN" ]]; then
47+
TAG="$(echo "$PLAN" | jq -r '.announcement_tag')"
48+
else
49+
TAG="$MANUAL_TAG"
50+
fi
51+
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
52+
53+
- name: Check cutoff date
54+
id: cutoff
55+
run: |
56+
if [[ "$(date -u +%Y-%m-%d)" < "2027-01-01" ]]; then
57+
echo "enabled=true" >> "$GITHUB_OUTPUT"
58+
else
59+
echo "enabled=false" >> "$GITHUB_OUTPUT"
60+
echo "Past 2027-01-01 cutoff; skipping legacy artifact publishing." >&2
61+
fi
62+
63+
- name: Repackage legacy-named binaries
64+
if: steps.cutoff.outputs.enabled == 'true'
65+
env:
66+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
TAG: ${{ steps.version.outputs.tag }}
68+
run: |
69+
set -euo pipefail
70+
workdir="$(mktemp -d)"
71+
cd "$workdir"
72+
73+
targets=(
74+
"aarch64-apple-darwin:pact-aarch64-macos:tar.xz"
75+
"x86_64-apple-darwin:pact-x86_64-macos:tar.xz"
76+
"aarch64-unknown-linux-gnu:pact-aarch64-linux-gnu:tar.xz"
77+
"aarch64-unknown-linux-musl:pact-aarch64-linux-musl:tar.xz"
78+
"x86_64-unknown-linux-gnu:pact-x86_64-linux-gnu:tar.xz"
79+
"x86_64-unknown-linux-musl:pact-x86_64-linux-musl:tar.xz"
80+
"x86_64-pc-windows-msvc:pact-x86_64-windows-msvc.exe:zip"
81+
)
82+
83+
for entry in "${targets[@]}"; do
84+
IFS=':' read -r target legacy_name archive_ext <<< "$entry"
85+
archive="pact-${target}.${archive_ext}"
86+
87+
echo "::group::${target}"
88+
gh release download "$TAG" --repo "${GITHUB_REPOSITORY}" -p "$archive" -O "$archive" --clobber
89+
90+
if [[ "$archive_ext" == "zip" ]]; then
91+
unzip -q "$archive"
92+
cp "pact.exe" "$legacy_name"
93+
else
94+
tar xJf "$archive"
95+
cp "pact-${target}/pact" "$legacy_name"
96+
chmod +x "$legacy_name"
97+
fi
98+
99+
gh release upload "$TAG" "$legacy_name" --repo "${GITHUB_REPOSITORY}" --clobber
100+
rm -rf "pact-${target}" "$archive"
101+
echo "::endgroup::"
102+
done

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -315,3 +315,14 @@ jobs:
315315
with:
316316
plan: ${{ needs.plan.outputs.val }}
317317
secrets: inherit
318+
319+
custom-legacy-artifacts:
320+
needs:
321+
- plan
322+
- announce
323+
uses: ./.github/workflows/legacy-artifacts.yml
324+
with:
325+
plan: ${{ needs.plan.outputs.val }}
326+
secrets: inherit
327+
permissions:
328+
"contents": "write"

Cargo.toml

Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1+
#:tombi toml-version = "v1.0.0"
2+
13
[package]
24
name = "pact"
35
version = "0.10.4"
4-
authors = ["Yousaf Nabi <you@saf.dev>"]
56
edition = "2021"
67
description = "Pact consolidated CLI - pact_core_mock_server, pact_verifier, pact-stub-server, pact-plugin-cli, pact-broker-cli in a single binary"
8+
readme = "README.md"
79
homepage = "https://www.pact.io"
810
repository = "https://github.com/pact-foundation/pact-cli"
9-
readme = "README.md"
11+
license = "MIT"
1012
keywords = [
1113
"pact-broker-client",
1214
"pact-mock-server",
1315
"pact-plugin",
1416
"pact-stub-server",
1517
"pact-verifier"
1618
]
17-
license = "MIT"
1819
include = [
1920
"/README.md",
2021
"CHANGELOG.md",
@@ -26,6 +27,29 @@ include = [
2627

2728
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
2829

30+
[workspace.metadata.dist]
31+
cargo-dist-version = "0.32.0"
32+
ci = "github"
33+
installers = ["shell", "powershell"]
34+
targets = [
35+
"aarch64-apple-darwin",
36+
# Waiting for https://github.com/briansmith/ring/pull/2803 to be released
37+
# "aarch64-pc-windows-msvc",
38+
"aarch64-unknown-linux-gnu",
39+
"aarch64-unknown-linux-musl",
40+
"x86_64-apple-darwin",
41+
"x86_64-pc-windows-msvc",
42+
"x86_64-unknown-linux-gnu",
43+
"x86_64-unknown-linux-musl",
44+
]
45+
install-path = "~/.pact/bin"
46+
post-announce-jobs = [
47+
"./publish-containers",
48+
"./notify-homebrew",
49+
"./legacy-artifacts"
50+
]
51+
github-custom-job-permissions = { publish-containers = { contents = "read", packages = "write" }, legacy-artifacts = { contents = "write" } }
52+
2953
[[bin]]
3054
name = "pact"
3155
path = "src/bin.rs"
@@ -77,32 +101,6 @@ tracing-subscriber = { version = "0.3.20", features = [
77101
[dev-dependencies]
78102
trycmd = "=1.2.0"
79103

80-
[profile.release]
81-
opt-level = "z" # Optimize for size.
82-
strip = true # Automatically strip symbols from the binary.
83-
lto = true
84-
panic = "abort"
85-
codegen-units = 1
86-
87-
[workspace.metadata.dist]
88-
cargo-dist-version = "0.32.0"
89-
ci = "github"
90-
installers = ["shell", "powershell"]
91-
targets = [
92-
"aarch64-apple-darwin",
93-
# Waiting for https://github.com/briansmith/ring/pull/2803 to be released
94-
# "aarch64-pc-windows-msvc",
95-
"aarch64-unknown-linux-gnu",
96-
"aarch64-unknown-linux-musl",
97-
"x86_64-apple-darwin",
98-
"x86_64-pc-windows-msvc",
99-
"x86_64-unknown-linux-gnu",
100-
"x86_64-unknown-linux-musl",
101-
]
102-
install-path = "~/.pact/bin"
103-
post-announce-jobs = ["./publish-containers", "./notify-homebrew"]
104-
github-custom-job-permissions = { publish-containers = { contents = "read", packages = "write" } }
105-
106104
[profile.dist]
107105
inherits = "release"
108106
opt-level = "z"

0 commit comments

Comments
 (0)