Skip to content

Commit 51323e7

Browse files
authored
Github action for publishing to npm with provenance metadata (#2103)
1 parent 1fb7898 commit 51323e7

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish Package to npm
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
branch:
6+
description: 'Git branch to build and publish'
7+
required: true
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
id-token: write
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
ref: ${{ github.event.inputs.branch }}
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: '20.x'
21+
registry-url: 'https://registry.npmjs.org'
22+
- run: npm install -g npm
23+
- run: npm install
24+
- run: npm test
25+
- run: npm publish --provenance --access public
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)