Skip to content

Commit 4f91d7f

Browse files
authored
ci: migrate to OIDC trusted publishing, add workflow_dispatch for prerelease testing (#125)
- Remove NPM_TOKEN / NODE_AUTH_TOKEN — publish now uses OIDC trusted publishing (no secrets needed) - Add workflow_dispatch trigger with prerelease checkbox: publishes to alpha dist-tag so we can verify OIDC works without touching latest - Drop --provenance flag (included automatically with trusted publishing) The release event path still publishes to latest as before; the only change is the auth mechanism. To test: bump version to x.y.z-alpha.0 on a branch, then run workflow with prerelease checked.
1 parent 0064ea0 commit 4f91d7f

1 file changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ on:
55
pull_request:
66
release:
77
types: [published]
8+
workflow_dispatch:
9+
inputs:
10+
prerelease:
11+
description: 'Publish as prerelease (alpha tag). Version must already be bumped in package.json on the branch.'
12+
type: boolean
13+
default: false
814

915
permissions:
1016
contents: read
@@ -31,7 +37,7 @@ jobs:
3137

3238
publish:
3339
runs-on: ubuntu-latest
34-
if: github.event_name == 'release'
40+
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true')
3541
environment: release
3642
needs: [test]
3743

@@ -48,6 +54,11 @@ jobs:
4854
registry-url: 'https://registry.npmjs.org'
4955

5056
- run: npm ci
51-
- run: npm publish --provenance --access public
52-
env:
53-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
57+
58+
- name: Publish to npm
59+
run: |
60+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
61+
npm publish --access public --tag alpha
62+
else
63+
npm publish --access public
64+
fi

0 commit comments

Comments
 (0)