Skip to content

Commit a8aec5d

Browse files
committed
Add publishing job, using token method for the first publish
1 parent 16f85b1 commit a8aec5d

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

.github/workflows/publish.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
on:
2+
release:
3+
types: [created, edited, published]
4+
workflow_dispatch:
5+
inputs:
6+
dryRun:
7+
description: Dry run only
8+
required: true
9+
default: true
10+
type: boolean
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
id-token: write
18+
steps:
19+
- uses: actions/checkout@v5
20+
- uses: actions/setup-node@v6
21+
with:
22+
node-version: 22
23+
registry-url: https://registry.npmjs.org
24+
- run: npm ci
25+
26+
- name: Publish package
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }}
29+
if: >
30+
(github.event_name == 'release' && github.event.action == 'published') ||
31+
(github.event_name == 'workflow_dispatch' && !inputs.dryRun)
32+
run: npm publish --provenance --access public
33+
34+
- name: Publish package (dry run)
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.REGISTRY_PUBLISH_TOKEN }}
37+
if: >
38+
(github.event_name == 'release' && github.event.action != 'published') ||
39+
(github.event_name == 'workflow_dispatch' && inputs.dryRun)
40+
run: npm publish --dry-run

0 commit comments

Comments
 (0)