返回 DeepSeek-Reasonix
release-promote.yml
根目录 / .github / workflows / release-promote.yml
1 name: Publish release candidate
2 run-name: ${{ inputs.operation }} ${{ inputs.candidate_id }}
3
4 on:
5 workflow_dispatch:
6 inputs:
7 candidate_id:
8 description: "Sealed candidate from Prepare release candidate"
9 required: true
10 type: string
11 operation:
12 description: "Publish a new identity or recover an interrupted publication"
13 required: true
14 default: publish
15 type: choice
16 options: [publish, recover]
17
18 concurrency:
19 group: stable-release-publication
20 cancel-in-progress: false
21
22 permissions:
23 actions: write
24 attestations: read
25 contents: write
26 issues: read # granted to the nested release workflows, which can render notes
27 pull-requests: read
28
29 jobs:
30 preflight:
31 name: verify sealed candidate before approval
32 if: github.repository == 'esengine/DeepSeek-Reasonix' && github.ref == 'refs/heads/main-v2' && github.ref_protected
33 runs-on: ubuntu-latest
34 permissions:
35 actions: read
36 attestations: read
37 contents: read
38 outputs:
39 tag_actor_id: ${{ steps.identity.outputs.actor_id }}
40 candidate_id: ${{ steps.record.outputs.candidate_id }}
41 version: ${{ steps.record.outputs.version }}
42 source_sha: ${{ steps.record.outputs.source_sha }}
43 producer_run_id: ${{ steps.record.outputs.producer_run_id }}
44 producer_run_attempt: ${{ steps.record.outputs.producer_run_attempt }}
45 candidate_control_sha: ${{ steps.record.outputs.candidate_control_sha }}
46 signing_fingerprint: ${{ steps.record.outputs.signing_fingerprint }}
47 desktop_prefix: ${{ steps.record.outputs.desktop_prefix }}
48 approved_artifact: approved-release-candidate-${{ github.run_id }}-${{ github.run_attempt }}
49 steps:
50 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
51 with:
52 fetch-depth: 0
53 ref: ${{ github.sha }}
54 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
55 with:
56 node-version: "22"
57 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
58 with:
59 go-version-file: go.mod
60 cache: false
61 - name: Validate executable contracts and public access before payload or approval
62 env:
63 CANDIDATE_ID: ${{ inputs.candidate_id }}
64 run: |
65 bash scripts/validate-release-control-plane.sh
66 version="${CANDIDATE_ID#v}"
67 bash scripts/check-release-public-access.sh "${version%%-*}"
68 - name: Resolve candidate record artifact
69 id: artifact
70 env:
71 GH_TOKEN: ${{ github.token }}
72 RELEASE_REVOKED_CANDIDATES: ${{ vars.RELEASE_REVOKED_CANDIDATES }}
73 run: node scripts/resolve-release-candidate.mjs resolve "${{ inputs.candidate_id }}"
74 - name: Download exact candidate record
75 env:
76 GH_TOKEN: ${{ github.token }}
77 ARTIFACT_ID: ${{ steps.artifact.outputs.record_artifact_id }}
78 PRODUCER_RUN_ID: ${{ steps.artifact.outputs.producer_run_id }}
79 run: |
80 mkdir -p record
81 gh api "repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID" > /tmp/record-artifact.json
82 gh api "repos/${{ github.repository }}/actions/runs/$PRODUCER_RUN_ID" > /tmp/producer-run.json
83 gh api "repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID/zip" > /tmp/record.zip
84 node scripts/verify-release-artifact-archive.mjs /tmp/record-artifact.json /tmp/record.zip
85 unzip -q /tmp/record.zip -d record
86 test -s record/record.json
87 - name: Verify record provenance and resolve exact payload
88 id: record
89 env:
90 GH_TOKEN: ${{ github.token }}
91 run: |
92 signer_sha="$(jq -r .head_sha /tmp/producer-run.json)"
93 gh attestation verify record/record.json --repo "$GITHUB_REPOSITORY" \
94 --signer-workflow "$GITHUB_REPOSITORY/.github/workflows/release-candidate.yml" \
95 --signer-digest "$signer_sha" --source-ref refs/heads/main-v2 --deny-self-hosted-runners
96 node scripts/resolve-release-candidate.mjs inspect "${{ inputs.candidate_id }}" \
97 record/record.json /tmp/record-artifact.json /tmp/producer-run.json
98 - name: Check the configured tag publisher before approval
99 id: identity
100 env:
101 GH_TOKEN: ${{ secrets.RELEASE_TAG_TOKEN }}
102 RELEASE_TAG_ACTOR: ${{ vars.RELEASE_TAG_ACTOR }}
103 run: node scripts/verify-release-tag-identity.mjs "${{ steps.record.outputs.version }}"
104 - name: Download exact candidate payload
105 env:
106 GH_TOKEN: ${{ github.token }}
107 PAYLOAD_ID: ${{ steps.record.outputs.payload_artifact_id }}
108 run: |
109 gh api "repos/${{ github.repository }}/actions/artifacts/$PAYLOAD_ID" > /tmp/payload-artifact.json
110 test "$(jq -r .name /tmp/payload-artifact.json)" = "${{ steps.record.outputs.payload_artifact_name }}"
111 test "$(jq -r .expired /tmp/payload-artifact.json)" = false
112 test "$(jq -r .workflow_run.id /tmp/payload-artifact.json)" = "${{ steps.record.outputs.producer_run_id }}"
113 mkdir -p payload
114 gh api "repos/${{ github.repository }}/actions/artifacts/$PAYLOAD_ID/zip" > /tmp/payload.zip
115 node scripts/verify-release-artifact-archive.mjs /tmp/payload-artifact.json /tmp/payload.zip
116 unzip -q /tmp/payload.zip -d payload
117 - name: Verify payload provenance, bytes, source, and operation
118 env:
119 GH_TOKEN: ${{ github.token }}
120 OPERATION: ${{ inputs.operation }}
121 VERSION: ${{ steps.record.outputs.version }}
122 SOURCE_SHA: ${{ steps.record.outputs.source_sha }}
123 run: |
124 set -euo pipefail
125 signer_digest="${{ steps.record.outputs.candidate_control_sha }}"
126 # Each check retries on its own, because the public-good verifier can fail
127 # to initialise on a shared runner; the first runs alone so the others
128 # find the trust cache built, then the rest run eight at a time and any
129 # single failure fails the step.
130 verify_provenance() {
131 local attempt=1
132 until gh attestation verify "$1" --repo "$GITHUB_REPOSITORY" \
133 --signer-workflow "$GITHUB_REPOSITORY/.github/workflows/release-candidate.yml" \
134 --signer-digest "$signer_digest" --source-ref refs/heads/main-v2 \
135 --deny-self-hosted-runners >/dev/null; do
136 test "$attempt" -lt 5 || return 1
137 attempt=$((attempt + 1))
138 sleep 6
139 done
140 }
141 export -f verify_provenance
142 export signer_digest
143 files=()
144 while IFS= read -r -d '' file; do files+=("$file"); done < <(find payload -type f -print0)
145 test "${#files[@]}" -gt 0
146 verify_provenance "${files[0]}"
147 if [ "${#files[@]}" -gt 1 ]; then
148 # shellcheck disable=SC2016 # the child shell must expand "$1" itself
149 printf '%s\0' "${files[@]:1}" | xargs -0 -P 8 -I{} bash -c 'verify_provenance "$1"' _ {}
150 fi
151 node scripts/release-candidate.mjs verify payload record/record.json >/dev/null
152 git fetch origin main-v2 --tags
153 git merge-base --is-ancestor "$SOURCE_SHA" origin/main-v2
154 git show "$SOURCE_SHA:release-notes/releases.json" > /tmp/catalog.json
155 test "$(sha256sum /tmp/catalog.json | awk '{print $1}')" = "$(jq -r .notes.catalogSha256 record/record.json)"
156 bash scripts/release-candidate-tags.sh check "$OPERATION" "$VERSION" "$SOURCE_SHA"
157 {
158 echo "### Sealed release approval"
159 echo
160 echo "- Candidate: \`${{ inputs.candidate_id }}\`"
161 echo "- Operation: \`$OPERATION\`"
162 echo "- Product SHA: \`$SOURCE_SHA\`"
163 echo "- Candidate record SHA-256: \`$(sha256sum record/record.json | awk '{print $1}')\`"
164 echo "- Notes SHA-256: \`$(jq -r .notes.renderedSha256 record/record.json)\`"
165 echo "- Signing policy: \`$(jq -r .signing.desktopFingerprint record/record.json)\`"
166 echo "- Payload files: \`$(jq '.files | length' record/record.json)\`"
167 echo "- Native acceptance: \`$(jq -r '[.acceptance[] | select(.status == "passed") | .kind] | join(", ")' record/record.json)\`"
168 } >> "$GITHUB_STEP_SUMMARY"
169 # A candidate sealed with its notes publishes those bytes without touching
170 # the network. One sealed before that renders offline from its own source.
171 - name: Bind reviewed release notes
172 run: |
173 sealed="$(jq -r '.notes.renderedPath // empty' record/record.json)"
174 if [ -n "$sealed" ]; then
175 cp "payload/$sealed" release-notes.md
176 else
177 worktree="$(mktemp -d "$RUNNER_TEMP/reasonix-notes.XXXXXX")"
178 git worktree add --detach "$worktree" "${{ steps.record.outputs.source_sha }}"
179 node "$worktree/scripts/release-notes.mjs" render --version "v${{ steps.record.outputs.version }}" --output release-notes.md
180 git worktree remove "$worktree"
181 fi
182 test "$(sha256sum release-notes.md | awk '{print $1}')" = "$(jq -r .notes.renderedSha256 record/record.json)"
183 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
184 with:
185 name: orchestrator-reviewed-release-notes
186 path: release-notes.md
187 if-no-files-found: error
188 retention-days: 1
189 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
190 with:
191 name: approved-release-candidate-${{ github.run_id }}-${{ github.run_attempt }}
192 path: payload
193 if-no-files-found: error
194 retention-days: 7
195 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
196 with:
197 name: ${{ steps.record.outputs.desktop_prefix }}-darwin-arm64
198 path: payload/desktop/darwin-arm64
199 if-no-files-found: error
200 retention-days: 7
201 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
202 with:
203 name: ${{ steps.record.outputs.desktop_prefix }}-darwin-amd64
204 path: payload/desktop/darwin-amd64
205 if-no-files-found: error
206 retention-days: 7
207 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
208 with:
209 name: ${{ steps.record.outputs.desktop_prefix }}-darwin-universal
210 path: payload/desktop/darwin-universal
211 if-no-files-found: error
212 retention-days: 7
213 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
214 with:
215 name: ${{ steps.record.outputs.desktop_prefix }}-windows-amd64
216 path: payload/desktop/windows-amd64
217 if-no-files-found: error
218 retention-days: 7
219 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
220 with:
221 name: ${{ steps.record.outputs.desktop_prefix }}-windows-arm64
222 path: payload/desktop/windows-arm64
223 if-no-files-found: error
224 retention-days: 7
225 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
226 with:
227 name: ${{ steps.record.outputs.desktop_prefix }}-linux-amd64
228 path: payload/desktop/linux-amd64
229 if-no-files-found: error
230 retention-days: 7
231
232 authorize:
233 name: approve sealed Stable candidate
234 needs: preflight
235 runs-on: ubuntu-latest
236 environment: release
237 permissions:
238 contents: read
239 outputs:
240 version: ${{ needs.preflight.outputs.version }}
241 source_sha: ${{ needs.preflight.outputs.source_sha }}
242 steps:
243 - run: echo "Approved ${{ needs.preflight.outputs.candidate_id }} at ${{ needs.preflight.outputs.source_sha }}"
244
245 activate:
246 name: atomically activate release identity
247 needs: [preflight, authorize]
248 runs-on: ubuntu-latest
249 permissions:
250 contents: read
251 steps:
252 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
253 with:
254 fetch-depth: 0
255 ref: ${{ github.sha }}
256 persist-credentials: false
257 - name: Create or verify all implementation tags
258 env:
259 GH_TOKEN: ${{ secrets.RELEASE_TAG_TOKEN }}
260 RELEASE_TAG_ACTOR: ${{ vars.RELEASE_TAG_ACTOR }}
261 RELEASE_TAG_ACTOR_ID: ${{ needs.preflight.outputs.tag_actor_id }}
262 OPERATION: ${{ inputs.operation }}
263 VERSION: ${{ needs.preflight.outputs.version }}
264 SOURCE_SHA: ${{ needs.preflight.outputs.source_sha }}
265 CANDIDATE_ID: ${{ needs.preflight.outputs.candidate_id }}
266 RELEASE_REVOKED_CANDIDATES: ${{ vars.RELEASE_REVOKED_CANDIDATES }}
267 run: |
268 set -euo pipefail
269 node scripts/verify-release-tag-identity.mjs "$VERSION"
270 gh auth setup-git --hostname github.com
271 node scripts/resolve-release-candidate.mjs active "$CANDIDATE_ID"
272 git fetch origin main-v2 --tags
273 bash scripts/release-candidate-tags.sh activate "$OPERATION" "$VERSION" "$SOURCE_SHA"
274
275 cli:
276 name: publish CLI and Homebrew from candidate
277 needs: [preflight, activate]
278 uses: ./.github/workflows/release.yml
279 with:
280 tag: v${{ needs.preflight.outputs.version }}
281 approved_cli_tag: v${{ needs.preflight.outputs.version }}
282 approved_sha: ${{ needs.preflight.outputs.source_sha }}
283 orchestrated: true
284 orchestrator: promote
285 candidate_artifact_name: ${{ needs.preflight.outputs.approved_artifact }}
286 candidate_verified: true
287 secrets: inherit
288
289 npm:
290 name: publish npm from candidate
291 needs: [preflight, activate]
292 permissions:
293 contents: read
294 id-token: write
295 uses: ./.github/workflows/release-npm.yml
296 with:
297 channel: stable
298 base_version: ${{ needs.preflight.outputs.version }}
299 tag: npm-v${{ needs.preflight.outputs.version }}
300 approved_cli_tag: v${{ needs.preflight.outputs.version }}
301 approved_sha: ${{ needs.preflight.outputs.source_sha }}
302 orchestrated: true
303 orchestrator: promote
304 candidate_artifact_name: ${{ needs.preflight.outputs.approved_artifact }}
305 candidate_verified: true
306 secrets: inherit
307
308 desktop:
309 name: publish Desktop from candidate
310 needs: [preflight, activate]
311 uses: ./.github/workflows/release-desktop.yml
312 with:
313 channel: stable
314 tag: desktop-v${{ needs.preflight.outputs.version }}
315 approved_cli_tag: v${{ needs.preflight.outputs.version }}
316 approved_sha: ${{ needs.preflight.outputs.source_sha }}
317 orchestrated: true
318 orchestrator: promote
319 signing_preflight_verified: true
320 preflight_artifact_prefix: ${{ needs.preflight.outputs.desktop_prefix }}
321 candidate_id: ${{ needs.preflight.outputs.candidate_id }}
322 candidate_source_run_id: ${{ needs.preflight.outputs.producer_run_id }}
323 candidate_source_run_attempt: ${{ needs.preflight.outputs.producer_run_attempt }}
324 candidate_control_sha: ${{ needs.preflight.outputs.candidate_control_sha }}
325 candidate_signing_fingerprint: ${{ needs.preflight.outputs.signing_fingerprint }}
326 candidate_verified: true
327 secrets: inherit
328
329 postflight:
330 name: verify every public Stable surface
331 timeout-minutes: 45
332 needs: [preflight, cli, npm, desktop]
333 if: ${{ always() && !cancelled() }}
334 runs-on: ubuntu-latest
335 permissions:
336 contents: write
337 steps:
338 - name: Require every publisher
339 env:
340 CLI_RESULT: ${{ needs.cli.result }}
341 NPM_RESULT: ${{ needs.npm.result }}
342 DESKTOP_RESULT: ${{ needs.desktop.result }}
343 run: |
344 for result in "$CLI_RESULT" "$NPM_RESULT" "$DESKTOP_RESULT"; do test "$result" = success; done
345 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
346 with:
347 ref: ${{ github.sha }}
348 - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
349 with:
350 node-version: "22"
351 - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
352 with:
353 go-version-file: go.mod
354 cache: false
355 - name: Reconcile public artifacts, release event, and durable ledger
356 env:
357 GH_TOKEN: ${{ github.token }}
358 RELEASE_REPOSITORY: ${{ github.repository }}
359 RELEASE_VERSION: ${{ needs.preflight.outputs.version }}
360 RELEASE_OPERATION: ${{ inputs.operation }}
361 RELEASE_EXPECTED_SHA: ${{ needs.preflight.outputs.source_sha }}
362 RELEASE_LEDGER_OUTPUT: /tmp/publication-ledger.json
363 CLI_PUBLISH_FROZEN: ${{ vars.CLI_PUBLISH_FROZEN == 'true' }}
364 run: bash scripts/reconcile-release-publication.sh
365 - name: Upload publication ledger
366 if: always()
367 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
368 with:
369 name: release-publication-ledger-${{ needs.preflight.outputs.candidate_id }}-${{ github.run_attempt }}
370 path: /tmp/publication-ledger.json
371 if-no-files-found: error
372 overwrite: true
373 retention-days: 90
374
375 metrics:
376 name: record publication timing
377 needs: [preflight, authorize, activate, cli, npm, desktop, postflight]
378 if: ${{ always() && !cancelled() }}
379 continue-on-error: true
380 runs-on: ubuntu-latest
381 permissions:
382 actions: read
383 contents: read
384 steps:
385 - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
386 with:
387 ref: ${{ github.sha }}
388 - name: Record queue, execution, and critical-path evidence
389 env:
390 GH_TOKEN: ${{ github.token }}
391 run: |
392 gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > "$RUNNER_TEMP/release-run.json"
393 gh api "repos/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID/jobs?filter=all&per_page=100" > "$RUNNER_TEMP/release-jobs.json"
394 node scripts/ci-timings.mjs \
395 --run "$RUNNER_TEMP/release-run.json" \
396 --jobs "$RUNNER_TEMP/release-jobs.json" \
397 --summary "$GITHUB_STEP_SUMMARY" \
398 --output "$RUNNER_TEMP/publication-timing.json" \
399 --title "Release publication timing"
400 - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
401 with:
402 name: release-publication-timing-${{ needs.preflight.outputs.candidate_id || github.run_id }}-${{ github.run_attempt }}
403 path: ${{ runner.temp }}/publication-timing.json
404 if-no-files-found: ignore
405 overwrite: true
406 retention-days: 90
407
407 lines YAML