Skip to content

Commit a2f81a0

Browse files
authored
Merge pull request #82 from github/liuliu/update-publish-workflow
Migrate to NPM trusted publishing
2 parents 3b06812 + 4a7a45e commit a2f81a0

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

.github/workflows/publish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ name: Publish
22
permissions:
33
contents: read
44
packages: write
5+
id-token: write # Required for OIDC
56

67
on:
78
release:
89
types: [created]
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version to publish (e.g., v1.2.3)'
14+
required: true
15+
type: string
916

1017
jobs:
1118
publish-npm:
1219
runs-on: ubuntu-22.04
1320
steps:
1421
- uses: actions/checkout@v3
15-
- uses: actions/setup-node@v3
22+
- uses: actions/setup-node@v4
1623
with:
1724
node-version: 20
1825
registry-url: https://registry.npmjs.org/
@@ -21,7 +28,5 @@ jobs:
2128
- run: npm test
2229
- run: npm version ${TAG_NAME} --git-tag-version=false
2330
env:
24-
TAG_NAME: ${{ github.event.release.tag_name }}
25-
- run: npm whoami; npm --ignore-scripts publish
26-
env:
27-
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
31+
TAG_NAME: ${{ github.event.release.tag_name || github.event.inputs.version }}
32+
- run: npm --ignore-scripts publish

0 commit comments

Comments
 (0)