Repository navigation
176 lines (161 loc) · 6.43 KB
/
Copy pathrelease.yml
File metadata and controls
176 lines (161 loc) · 6.43 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
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Release
on:
workflow_dispatch:
inputs:
tag:
description: "Stable version to promote from its latest passing prerelease (e.g. v0.0.4)"
required: true
type: string
notes-only:
description: "Generate a release notes artifact without promoting or publishing"
required: false
default: false
type: boolean
permissions:
contents: read
concurrency:
group: ${{ inputs.notes-only && format('release-notes-preview-{0}', github.ref) || 'release-stable' }}
cancel-in-progress: false
queue: max
jobs:
preview-notes:
name: Preview Release Notes
if: ${{ inputs.notes-only }}
permissions:
contents: read
pull-requests: read
uses: ./.github/workflows/release-notes.yml
with:
release-tag: ${{ inputs.tag }}
secrets:
LLM_INFERENCE_API_KEY: ${{ secrets.LLM_INFERENCE_API_KEY }}
promote:
name: Select Qualified Prerelease
if: ${{ !inputs.notes-only }}
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: write
outputs:
tag: ${{ steps.candidate.outputs.tag }}
source-sha: ${{ steps.candidate.outputs.source_sha }}
make-latest: ${{ steps.candidate.outputs.make_latest }}
notes-reused: ${{ steps.notes.outputs.reused }}
steps:
- name: Require a release branch
env:
REF_TYPE: ${{ github.ref_type }}
run: test "${REF_TYPE}" = branch
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "0.10.12"
python-version: "3.13"
- name: Select candidate and verify qualification evidence
id: candidate
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ inputs.tag }}
RELEASE_BRANCH: ${{ github.ref_name }}
run: |
set -euo pipefail
uv run --no-project python tasks/scripts/select-release-candidate.py \
"${RELEASE_TAG}" --branch "${RELEASE_BRANCH}" > promotion.json
jq -r 'to_entries[] | "\(.key)=\(.value)"' promotion.json >> "${GITHUB_OUTPUT}"
{
echo "## Stable release promotion"
jq -r '"- Prerelease: `\(.candidate_tag)`\n- Stable tag: `\(.tag)`\n- Source commit: `\(.source_sha)`\n- Qualification: \(.qualification_run_url)\n- Update shared latest channels: \(.make_latest)"' promotion.json
echo
echo "Stable artifacts are rebuilt from this qualified commit with the stable version."
} >> "${GITHUB_STEP_SUMMARY}"
- name: Retain promotion record
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: stable-promotion-${{ inputs.tag }}-${{ github.run_id }}-${{ github.run_attempt }}
path: promotion.json
retention-days: 90
if-no-files-found: error
# Without a preview (missing or expired), Publish generates the notes instead.
- name: Reuse the prerelease notes preview
id: notes
env:
GH_TOKEN: ${{ github.token }}
RUN_ID: ${{ steps.candidate.outputs.qualification_run_id }}
CANDIDATE_TAG: ${{ steps.candidate.outputs.candidate_tag }}
RELEASE_TAG: ${{ steps.candidate.outputs.tag }}
run: |
set -euo pipefail
if gh run download "${RUN_ID}" -R "${GITHUB_REPOSITORY}" -n release-notes -D notes; then
sed -i "s/${CANDIDATE_TAG//./\\.}\b/${RELEASE_TAG}/g" notes/release-notes.md
echo "reused=true" >> "${GITHUB_OUTPUT}"
echo "Release notes are reused from the \`${CANDIDATE_TAG}\` preview." >> "${GITHUB_STEP_SUMMARY}"
else
echo "Release notes will be regenerated; the \`${CANDIDATE_TAG}\` preview is unavailable." >> "${GITHUB_STEP_SUMMARY}"
fi
- name: Upload release notes
if: ${{ steps.notes.outputs.reused == 'true' }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: release-notes
path: notes/release-notes.md
if-no-files-found: error
- name: Create stable tag at the qualified commit
env:
GH_TOKEN: ${{ github.token }}
RELEASE_TAG: ${{ steps.candidate.outputs.tag }}
SOURCE_SHA: ${{ steps.candidate.outputs.source_sha }}
run: |
set -euo pipefail
if git show-ref --verify --quiet "refs/tags/${RELEASE_TAG}"; then
test "$(git rev-parse "refs/tags/${RELEASE_TAG}^{commit}")" = "${SOURCE_SHA}"
else
gh api --method POST "repos/${GITHUB_REPOSITORY}/git/refs" \
-f "ref=refs/tags/${RELEASE_TAG}" -f "sha=${SOURCE_SHA}"
fi
build:
name: Build
needs: promote
permissions:
actions: read
contents: read
packages: write
uses: ./.github/workflows/release-build.yml
with:
release-tag: ${{ needs.promote.outputs.tag }}
expected-source-sha: ${{ needs.promote.outputs.source-sha }}
is-prerelease: false
secrets:
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
publish:
name: Publish
needs: [promote, build]
permissions:
actions: read
contents: write
pull-requests: read
packages: write
id-token: write
attestations: write
artifact-metadata: write
uses: ./.github/workflows/release-publish.yml
with:
release-tag: ${{ needs.promote.outputs.tag }}
source-sha: ${{ needs.build.outputs.source_sha }}
semver: ${{ needs.build.outputs.semver }}
python-version: ${{ needs.build.outputs.python_version }}
npm-version: ${{ needs.build.outputs.npm_version }}
is-prerelease: false
make-latest: ${{ needs.promote.outputs.make-latest == 'true' }}
release-notes-reused: ${{ needs.promote.outputs.notes-reused == 'true' }}
secrets:
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }}
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
GITLAB_CI_TRIGGER_TOKEN: ${{ secrets.GITLAB_CI_TRIGGER_TOKEN }}
GITLAB_CI_TRIGGER_URL: ${{ secrets.GITLAB_CI_TRIGGER_URL }}
LLM_INFERENCE_API_KEY: ${{ secrets.LLM_INFERENCE_API_KEY }}