-
Notifications
You must be signed in to change notification settings - Fork 11
224 lines (216 loc) · 8.03 KB
/
Copy pathrelease.yml
File metadata and controls
224 lines (216 loc) · 8.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
name: Stable release
run-name: Stable v${{ inputs.version }} plan:${{ inputs.plan_id }}
on:
workflow_dispatch:
inputs:
version:
description: SemVer without v prefix
required: true
rc_tag:
description: Soaked RC tag
required: true
ref:
description: Candidate ref or commit
required: true
plan_id:
description: Confirmed cargo-xtask plan ID
required: true
permissions:
contents: read
concurrency:
group: stable-${{ inputs.version }}
cancel-in-progress: false
jobs:
authorize:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
permissions:
contents: read
attestations: read
timeout-minutes: 120
outputs:
commit: ${{ steps.commit.outputs.sha }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ inputs.ref }}
fetch-depth: 0
- uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
with:
toolchain: 1.95.0
- id: commit
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
- name: Install pinned contract API tool
run: |
rustup toolchain install nightly-2026-04-15 --profile minimal
cargo install cargo-public-api --version '=0.50.1' --locked
- name: Recompute every promotion gate and verify plan
shell: bash
env:
VERSION: ${{ inputs.version }}
RC_TAG: ${{ inputs.rc_tag }}
CANDIDATE_REF: ${{ inputs.ref }}
PLAN_ID: ${{ inputs.plan_id }}
run: |
cargo xtask release plan \
--version "$VERSION" \
--rc-tag "$RC_TAG" \
--ref "$CANDIDATE_REF" \
--output recomputed-plan.json --json > recomputed-plan-report.json
actual=$(python3 -c 'import json; print(json.load(open("recomputed-plan.json"))["plan_id"])')
test "$actual" = "$PLAN_ID"
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: stable-plan
path: recomputed-plan.json
build-assets:
needs: authorize
name: build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: aarch64-apple-darwin
os: macos-14
- target: x86_64-apple-darwin
os: macos-14
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ needs.authorize.outputs.commit }}
- name: Install native build dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y musl-tools cmake
- uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
with:
toolchain: 1.95.0
targets: ${{ matrix.target }}
- uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-stable-${{ matrix.target }}-${{ hashFiles('Cargo.lock') }}
- name: Build release binary
env:
CC_x86_64_unknown_linux_musl: musl-gcc
CXX_x86_64_unknown_linux_musl: g++
run: cargo build --release --locked --target '${{ matrix.target }}' --bin rosalind
- name: Stage bundle
run: scripts/stage-release.sh '${{ matrix.target }}'
- name: Install-smoke staged bundle
if: matrix.target != 'x86_64-apple-darwin'
shell: bash
run: |
install_root=$(mktemp -d)
tar -xzf "dist/rosalind-${{ matrix.target }}.tar.gz" -C "$install_root"
"$install_root/rosalind-${{ matrix.target }}/rosalind" --version
- uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0
- name: Generate SPDX SBOM
run: syft 'dir:dist/rosalind-${{ matrix.target }}' -o 'spdx-json=dist/rosalind-${{ matrix.target }}.spdx.json'
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: stable-${{ matrix.target }}
path: |
dist/rosalind-${{ matrix.target }}.tar.gz
dist/rosalind-${{ matrix.target }}.tar.gz.sha256
dist/rosalind-${{ matrix.target }}.spdx.json
publish-crates:
needs: [authorize, build-assets]
runs-on: ubuntu-latest
environment: release
permissions:
contents: read
timeout-minutes: 45
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ needs.authorize.outputs.commit }}
- uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
with:
toolchain: 1.95.0
- name: Resume byte-verified crates.io publication
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: scripts/release-publish.sh
- uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: crate-publication-state
if-no-files-found: warn
path: publish-state.json
published-install-smoke:
needs: [authorize, publish-crates]
name: fresh registry install (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
contents: read
timeout-minutes: 90
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-14]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ needs.authorize.outputs.commit }}
- uses: dtolnay/rust-toolchain@4be7066ada62dd38de10e7b70166bc74ed198c30 # stable
with:
toolchain: 1.95.0
- name: Install native build dependencies
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y cmake
- name: Empty-cache install, demo, scaffold, and conformance
env:
VERSION: ${{ inputs.version }}
run: scripts/post-publish-smoke.sh "$VERSION"
publish-release:
needs: [authorize, build-assets, publish-crates, published-install-smoke]
runs-on: ubuntu-latest
environment: release
permissions:
contents: write
id-token: write
attestations: write
timeout-minutes: 20
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
ref: ${{ needs.authorize.outputs.commit }}
fetch-depth: 0
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
pattern: stable-*
path: release-assets
merge-multiple: true
- uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2
with:
subject-path: release-assets/*.tar.gz
- name: Create stable tag and GitHub Release last
env:
GH_TOKEN: ${{ github.token }}
TAG: v${{ inputs.version }}
COMMIT: ${{ needs.authorize.outputs.commit }}
shell: bash
run: |
remote=$(git ls-remote origin "refs/tags/$TAG" | awk '{print $1}')
if [ -n "$remote" ]; then
git fetch --force origin "refs/tags/$TAG:refs/tags/$TAG"
test "$(git rev-list -n 1 "$TAG")" = "$COMMIT" || { echo "$TAG targets another commit" >&2; exit 5; }
else
git tag -a "$TAG" "$COMMIT" -m "Rosalind $TAG"
git push origin "refs/tags/$TAG"
fi
if gh release view "$TAG" --repo '${{ github.repository }}' >/dev/null 2>&1; then
test "$(gh release view "$TAG" --repo '${{ github.repository }}' --json isPrerelease --jq .isPrerelease)" = false
else
gh release create "$TAG" release-assets/* \
--repo '${{ github.repository }}' --verify-tag --target "$COMMIT" --latest \
--title "Rosalind $TAG" --generate-notes
fi