Skip to content

Commit 480fd87

Browse files
authored
chore(ci): split release.yml into build/publish/release-notes/notify jobs (#128)
Splits the single release job into 4 jobs so the `id-token: write` scope is held only by a publish job that runs `npm publish` exclusively (no install/test/build/exec). - **build** (no `id-token`): install, typecheck, test, build, validate, upload `dist/` + package metadata as artifact. - **publish** (`id-token: write`): download artifact, `npm publish --ignore-scripts`. - **release-notes** (`contents: write`, no `id-token`): `npx changelogithub`. - **notify** (`if: always()`): slack notification, aggregates `needs.*.result`. Workflow-level permissions are tightened to `contents: read`; each job opts in to only the scopes it needs. Resolves the supply-chain audit `oidc-publish-fused` finding. Motivated by the TanStack npm supply-chain compromise (May 2026). Mirrors marimo-team/codemirror-ai#111.
1 parent e24f371 commit 480fd87

1 file changed

Lines changed: 59 additions & 11 deletions

File tree

.github/workflows/release.yml

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
name: Release
22

33
permissions:
4-
id-token: write # Required for OIDC
5-
contents: write
4+
contents: read
65

76
on:
87
push:
98
tags:
109
- 'v*'
1110

1211
jobs:
13-
release:
12+
build:
1413
runs-on: ubuntu-latest
1514
steps:
1615
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -24,12 +23,10 @@ jobs:
2423
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
2524
with:
2625
node-version: 24
27-
registry-url: 'https://registry.npmjs.org'
2826
cache: pnpm
2927

30-
3128
- name: 📥 Install dependencies
32-
run: pnpm install --frozen-lockfile
29+
run: pnpm install --ignore-scripts --frozen-lockfile
3330

3431
- name: 🔍 Type Check
3532
run: pnpm run typecheck
@@ -64,21 +61,72 @@ jobs:
6461
6562
echo "✅ Build artifacts validation passed"
6663
64+
- name: 📤 Upload package artifact
65+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
66+
with:
67+
name: package
68+
path: |
69+
dist/
70+
package.json
71+
README.md
72+
LICENSE
73+
retention-days: 1
74+
if-no-files-found: error
75+
76+
publish:
77+
needs: build
78+
runs-on: ubuntu-latest
79+
permissions:
80+
id-token: write
81+
contents: read
82+
steps:
83+
- name: ⎔ Setup pnpm
84+
uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4
85+
86+
- name: ⎔ Setup Node.js
87+
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
88+
with:
89+
node-version: 24
90+
registry-url: 'https://registry.npmjs.org'
91+
92+
- name: 📥 Download package artifact
93+
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
94+
with:
95+
name: package
96+
6797
- name: 📦 Publish to NPM
68-
run: pnpm publish --no-git-checks
98+
run: pnpm publish --no-git-checks --ignore-scripts
6999
env:
70100
NODE_AUTH_TOKEN: "" # Clear placeholder set by setup-node to enable OIDC
71101

102+
release-notes:
103+
needs: publish
104+
runs-on: ubuntu-latest
105+
permissions:
106+
contents: write
107+
steps:
108+
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
109+
with:
110+
fetch-depth: 0
111+
112+
- name: ⎔ Setup Node.js
113+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
114+
with:
115+
node-version: 24
72116

73117
- name: 📝 Update Changelog
74-
run: npx changelogithub
118+
run: npx changelogithub@14.0.0
75119
env:
76-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
120+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77121

122+
notify:
123+
needs: [build, publish, release-notes]
124+
if: always()
125+
runs-on: ubuntu-latest
126+
steps:
78127
- name: 📣 Notify release result
79-
if: always()
80128
uses: marimo-team/internal-gh-actions/release-notification@ba06d4db1f3c5c9b86983ce409e57196f8376777 # main
81129
with:
82-
status: ${{ job.status }}
130+
status: ${{ (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && 'failure' || 'success' }}
83131
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL_RELEASES }}
84132
artifact-url: "https://npmjs.com/package/@marimo-team/codemirror-sql"

0 commit comments

Comments
 (0)