Repository navigation
384 lines (374 loc) · 15.7 KB
/
Copy pathrelease.yml
File metadata and controls
384 lines (374 loc) · 15.7 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
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
name: Release
on:
workflow_dispatch:
inputs:
source_run_id:
description: Original Release run ID (or a previous recovery run) for this exact branch SHA
required: true
type: string
source_attempt:
description: Original run attempt containing the retained npm evidence
required: true
type: string
version:
description: Exact archived npm version to resume
required: true
type: string
confirm:
description: Type RECOVER NPM ONLY to authorize resuming this cohort without deployment
required: true
type: string
push:
branches:
- main
- alpha
- beta
- rc
- canary
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
validation:
if: ${{ github.event_name == 'push' }}
uses: ./.github/workflows/validation.yml
# Only validation's turbo-cache-prune job uses actions: write.
permissions:
contents: read
actions: write
with:
base_sha: ${{ github.event.before }}
head_sha: ${{ github.sha }}
full: true
release_build: true
site_delivery: ${{ github.ref_name == 'main' }}
release:
if: ${{ github.event_name == 'push' }}
needs: validation
outputs:
released: ${{ steps.outcome.outputs.released }}
version: ${{ steps.outcome.outputs.version }}
revision: ${{ steps.outcome.outputs.revision }}
artifact_name: ${{ steps.outcome.outputs.artifact_name }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/setup-bun
with:
turbo-cache-scope: build
- name: Download Tier-1 native artifacts
uses: actions/download-artifact@v7
with:
pattern: mastercss-binding-*
path: binding-artifacts
- name: Verify and stage Tier-1 native artifacts
run: cargo xtask assemble-native-release binding-artifacts release-artifacts/checksums.json --stage
- run: bun run build
- name: Finalize release checksums
run: cargo xtask assemble-native-release binding-artifacts release-artifacts/checksums.json --require-assets --verify-staged
- name: Install publishing npm CLI
run: npm install --global npm@11.21.0
- name: Verify OIDC publication and package order
run: |
test "$(npm --version)" = 11.21.0
bun run check:release
node --test scripts/release.test.mjs scripts/release-workspace.test.mjs scripts/release-promotion.test.mjs scripts/release-registry-provenance.test.mjs
# A push without release commits, or a rerun on a tagged commit, publishes no editor.
- name: Plan the release
id: plan
run: node scripts/release.mjs --dry-run --github-output
- name: Require unused editor versions before publishing npm
if: ${{ needs.validation.outputs.vscode_release_affected == 'true' && steps.plan.outputs.version != '' }}
env:
EDITOR_NPM_VERSION: ${{ steps.plan.outputs.version }}
run: |
set -euo pipefail
version=$(node packages/vscode/scripts/editor-version.mjs --npm-version "$EDITOR_NPM_VERSION")
node packages/vscode/scripts/verify-store-availability.mjs --version "$version"
- run: bun run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MASTER_CSS_RELEASE_STAGE: "1"
MASTER_CSS_RELEASE_PROMOTE: "1"
- name: Bind delivery to the actual completed release
id: outcome
run: |
node scripts/release-outcome.mjs
echo "artifact_name=npm-release-${GITHUB_SHA}-${GITHUB_RUN_ATTEMPT}" >> "$GITHUB_OUTPUT"
- name: Preserve publication inventory and recovery evidence
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: npm-release-${{ github.sha }}-${{ github.run_attempt }}
path: |
release-artifacts/promotion-state.json
release-artifacts/packages/*.tgz
release-artifacts/checksums.json
if-no-files-found: warn
retention-days: 90
- name: Preserve complete release notes
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: release-notes-${{ github.sha }}-${{ github.run_attempt }}
path: release-artifacts/release-notes.md
if-no-files-found: warn
retention-days: 90
deploy-site:
needs:
- validation
- release
- publish-editors
# The site deploys on its own, not only with a release. `plan` delivers a release with its
# version, and any other push with the channel's newest release, whatever it changed; only a
# pending release that failed to publish holds the site until it ships.
if: ${{ always() && github.event_name == 'push' && needs.validation.result == 'success' && needs.release.result == 'success' && github.ref_name == 'main' && needs.validation.outputs.site_affected == 'true' && (needs.release.outputs.released != 'true' || needs.publish-editors.result == 'success' || (needs.validation.outputs.vscode_release_affected != 'true' && needs.publish-editors.result == 'skipped')) }}
runs-on: ubuntu-latest
timeout-minutes: 75
permissions:
contents: write
checks: read
env:
PUBLIC_COMMIT_REF: ${{ github.ref_name }}
PUBLIC_URL: https://css.master.co
MASTER_CSS_IMAGE_TRANSFORMATIONS: "false"
MASTER_LEGACY_DESIGN_CUTOVER: ${{ vars.MASTER_LEGACY_DESIGN_CUTOVER == '1' && '1' || '0' }}
PAGES_PROJECT: ${{ vars.CLOUDFLARE_PAGES_PROJECT }}
PAGES_SUBDOMAIN: ${{ vars.CLOUDFLARE_PAGES_SUBDOMAIN }}
PAGES_RELEASE_MODE: ${{ vars.CLOUDFLARE_PAGES_MODE }}
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
fetch-depth: 0
persist-credentials: false
- uses: ./.github/actions/setup-bun
with:
turbo-cache-scope: build
- name: Test the non-deploying Pages release contracts
run: node --test scripts/pages-site-manifest.test.mjs scripts/pages-site-release.test.mjs scripts/pages-release-github.test.mjs
# Sets PUBLIC_VERSION and SITE_DELIVERY for the following steps when the site delivers.
- name: Plan the site delivery for this push
id: plan
run: node scripts/pages-site-release.mjs plan
env:
RELEASED: ${{ needs.release.outputs.released }}
RELEASE_VERSION: ${{ needs.release.outputs.version }}
- name: Download the completed npm cohort evidence from its owning attempt
if: ${{ steps.plan.outputs.deliver == 'true' && needs.release.outputs.released == 'true' }}
uses: actions/download-artifact@v7
with:
name: ${{ needs.release.outputs.artifact_name }}
path: release-artifacts/npm
- name: Require the actual source tag and complete public registry cohort
if: ${{ steps.plan.outputs.deliver == 'true' }}
run: node scripts/pages-site-release.mjs preflight
# Validation already built and browser-verified a site-only delivery with its identity.
- name: Download the site that validation verified for this delivery
if: ${{ steps.plan.outputs.deliver == 'true' && env.SITE_DELIVERY == 'site' }}
continue-on-error: true
uses: actions/download-artifact@v7
with:
name: site-validation-${{ github.sha }}
path: site
# Reuses it only when its report proves these exact bytes and identity; otherwise rebuilds.
- name: Reuse the verified validation site when it is this exact delivery
id: reuse
if: ${{ steps.plan.outputs.deliver == 'true' }}
run: node scripts/pages-site-release.mjs reuse
# The external Git builder must reproduce these final, browser-tested bytes.
- name: Build and verify the exact site revision
if: ${{ steps.plan.outputs.deliver == 'true' && steps.reuse.outputs.reused != 'true' }}
run: |
bun run build:site
bun run --filter site test:css-contract
bun run --filter site test:llms
bun run --filter site test:docs-examples
node scripts/pages-site-release.mjs identity
bun run playwright install --with-deps chromium firefox webkit
node site/scripts/verify-release-site.mjs --out site/out --origin "$PUBLIC_URL" --report site/test-results/release-site.json
- name: Create the output manifest from the browser proof
if: ${{ steps.plan.outputs.deliver == 'true' }}
run: node scripts/pages-site-release.mjs manifest
- name: Retain the verified site output
if: ${{ steps.plan.outputs.deliver == 'true' }}
uses: actions/upload-artifact@v7
with:
name: site-release-${{ github.sha }}
path: |
site/out/
site/test-results/release-site.json
site/test-results/document-examples/
release-artifacts/site.manifest.json
if-no-files-found: error
retention-days: 30
- name: Create the immutable public manifest and advance the exact Pages Git ref
if: ${{ steps.plan.outputs.deliver == 'true' }}
run: node scripts/pages-site-release.mjs deliver
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Retain exact Git deployment and canonical verification results
if: ${{ always() && steps.plan.outputs.deliver == 'true' }}
uses: actions/upload-artifact@v7
with:
name: site-delivery-${{ github.sha }}-${{ github.run_attempt }}
path: release-artifacts/site-delivery.json
if-no-files-found: warn
retention-days: 90
publish-editors:
needs:
- validation
- release
if: ${{ github.event_name == 'push' && needs.release.outputs.released == 'true' && (github.ref_name == 'main' || github.ref_name == 'rc') && needs.validation.outputs.vscode_release_affected == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: ./.github/actions/setup-bun
with:
ignore-scripts: "true"
turbo-cache: "false"
# The evidence check below then requires the tested VSIX to carry this version.
- name: Use the editor version of the actual npm release
env:
EDITOR_NPM_VERSION: ${{ needs.release.outputs.version }}
run: |
set -euo pipefail
version=$(node packages/vscode/scripts/editor-version.mjs --npm-version "$EDITOR_NPM_VERSION")
node packages/vscode/scripts/editor-version.mjs --stamp "$version"
- name: Download the exact VSIX candidates verified in this release run
uses: actions/download-artifact@v7
with:
name: editor-vsix
path: candidate-vsix
- name: Download every installed extension-host proof from this run
uses: actions/download-artifact@v7
with:
pattern: editor-proof-*
path: editor-proofs
merge-multiple: true
- name: Require the tested bytes, exact source revision and all sixteen host proofs
run: node packages/vscode/scripts/verify-editor-evidence.mjs --candidate-dir candidate-vsix --proof-dir editor-proofs
- name: Validate editor publishing configuration
run: |
if [ -z "$OVSX_PAT" ]; then
echo "OVSX_PAT is required to publish Open VSX extension."
exit 1
fi
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
- name: Preserve the exact editor candidates before publication
uses: actions/upload-artifact@v7
with:
name: editor-release-${{ github.sha }}
path: |
candidate-vsix/
editor-proofs/
if-no-files-found: error
retention-days: 90
- name: Azure login for VSCE
uses: azure/login@a641126d1b8aa4d1fa005f4f92df94a3a4c4c906 # v3.1.0
with:
client-id: ${{ vars.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Publish VS Code Marketplace extension
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
files=("$GITHUB_WORKSPACE"/candidate-vsix/masterco/*.vsix)
if [ "${#files[@]}" -ne 8 ]; then
echo "Expected eight verified Marketplace VSIX files."
exit 1
fi
bun run --filter @master/css-vscode vsce verify-pat --azure-credential masterco
bun run --filter @master/css-vscode vsce publish \
--azure-credential \
--packagePath "${files[@]}"
- name: Publish Open VSX extension
shell: bash
run: |
set -euo pipefail
shopt -s nullglob
files=("$GITHUB_WORKSPACE"/candidate-vsix/master/*.vsix)
if [ "${#files[@]}" -ne 8 ]; then
echo "Expected eight verified Open VSX VSIX files."
exit 1
fi
for file in "${files[@]}"; do
bun x ovsx@1.0.2 publish "$file"
done
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
# Every stable release lists its @master/css-mcp version in the MCP Registry.
mcp-registry:
needs: release
if: ${{ github.event_name == 'push' && needs.release.outputs.released == 'true' && github.ref_name == 'main' }}
permissions:
contents: read
id-token: write
uses: ./.github/workflows/mcp-registry.yml
with:
version: ${{ needs.release.outputs.version }}
npm-recovery:
name: Recover the explicitly selected npm cohort
if: ${{ github.event_name == 'workflow_dispatch' && github.ref_type == 'branch' && contains(fromJSON('["main","alpha","beta","rc","canary"]'), github.ref_name) }}
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
id-token: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.sha }}
persist-credentials: false
- uses: ./.github/actions/setup-bun
with:
ignore-scripts: "true"
turbo-cache: "false"
- name: Verify and restore the original release evidence
id: evidence
run: node scripts/release-recovery-artifact.mjs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RECOVERY_RUN_ID: ${{ inputs.source_run_id }}
RECOVERY_ATTEMPT: ${{ inputs.source_attempt }}
RECOVERY_VERSION: ${{ inputs.version }}
RECOVERY_CONFIRM: ${{ inputs.confirm }}
- name: Install the OIDC-capable publishing npm CLI
run: |
npm install --global npm@11.21.0
test "$(npm --version)" = 11.21.0
- name: Resume verified npm uploads and promotion only
run: node scripts/release-recover.mjs --state "$RECOVERY_STATE" --channel "$RECOVERY_CHANNEL"
env:
RECOVERY_STATE: ${{ steps.evidence.outputs.state }}
RECOVERY_CHANNEL: ${{ steps.evidence.outputs.channel }}
MASTER_CSS_RELEASE_STAGE: "1"
MASTER_CSS_RELEASE_PROMOTE: "1"
MASTER_CSS_RELEASE_RECOVERY: "1"
- name: Preserve recovery evidence even after partial failure
if: ${{ always() && steps.evidence.outcome == 'success' }}
uses: actions/upload-artifact@v7
with:
name: npm-release-${{ github.sha }}-${{ github.run_attempt }}
path: |
release-artifacts/recovery/promotion-state.json
release-artifacts/recovery/packages/*.tgz
release-artifacts/recovery/checksums.json
if-no-files-found: error
retention-days: 90