Skip to content

Commit 3d83c00

Browse files
fix: use npm OIDC trusted publishing (no NPM_TOKEN needed)
- Remove NPM_TOKEN requirement, use OIDC like changeset workflow - Add id-token: write permission to publish-npm job - Upgrade npm for OIDC support - Fix Docker latest tag for release workflow
1 parent 975c857 commit 3d83c00

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/release.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -116,11 +116,12 @@ jobs:
116116
retention-days: 1
117117

118118
publish-npm:
119-
name: Publish to npm
119+
name: Publish to npm (OIDC)
120120
needs: assemble-npm
121121
runs-on: ubuntu-latest
122-
# Only run if NPM_TOKEN secret is configured
123-
if: ${{ vars.NPM_PUBLISH_ENABLED == 'true' }}
122+
permissions:
123+
contents: read
124+
id-token: write # Required for npm OIDC trusted publishing
124125
steps:
125126
- uses: actions/checkout@v4
126127

@@ -130,15 +131,16 @@ jobs:
130131
node-version: '20'
131132
registry-url: 'https://registry.npmjs.org'
132133

134+
- name: Upgrade npm for OIDC support
135+
run: npm install -g npm@latest
136+
133137
- name: Download npm packages
134138
uses: actions/download-artifact@v4
135139
with:
136140
name: npm-packages
137141
path: packages/
138142

139143
- name: Publish platform packages
140-
env:
141-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
142144
run: |
143145
for pkg in packages/ansilust-*/; do
144146
if [ -f "$pkg/package.json" ]; then
@@ -150,8 +152,6 @@ jobs:
150152
done
151153
152154
- name: Publish meta package
153-
env:
154-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
155155
run: npm publish packages/ansilust/ --provenance --access public || echo "Failed to publish meta package (may already exist)"
156156

157157
create-release:
@@ -292,7 +292,7 @@ jobs:
292292
tags: |
293293
type=semver,pattern={{version}}
294294
type=semver,pattern={{major}}.{{minor}}
295-
type=raw,value=latest,enable={{is_default_branch}}
295+
type=raw,value=latest
296296
297297
- name: Build and push
298298
uses: docker/build-push-action@v5

0 commit comments

Comments
 (0)