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.
This commit is contained in:
parent
0064ea0c95
commit
4f91d7f324
1 changed files with 15 additions and 4 deletions
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
|
|
@ -5,6 +5,12 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
prerelease:
|
||||||
|
description: 'Publish as prerelease (alpha tag). Version must already be bumped in package.json on the branch.'
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -31,7 +37,7 @@ jobs:
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event_name == 'release'
|
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.prerelease == 'true')
|
||||||
environment: release
|
environment: release
|
||||||
needs: [test]
|
needs: [test]
|
||||||
|
|
||||||
|
|
@ -48,6 +54,11 @@ jobs:
|
||||||
registry-url: 'https://registry.npmjs.org'
|
registry-url: 'https://registry.npmjs.org'
|
||||||
|
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm publish --provenance --access public
|
|
||||||
env:
|
- name: Publish to npm
|
||||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
run: |
|
||||||
|
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
|
||||||
|
npm publish --access public --tag alpha
|
||||||
|
else
|
||||||
|
npm publish --access public
|
||||||
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue