Skip to content

Commit d602cdf

Browse files
committed
feat: setup trusted publisher
1 parent 308f620 commit d602cdf

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

.github/workflows/npm-release.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish package
2+
on:
3+
release:
4+
types: [created]
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
environment: prod
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v6
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v6
20+
with:
21+
node-version: 24
22+
registry-url: https://registry.npmjs.org
23+
24+
- name: Version
25+
if: github.event_name == 'release' && github.event.action == 'created'
26+
run: |
27+
VERSION=${{ github.event.release.tag_name }}
28+
VERSION=${VERSION:1}
29+
CURRENT_VERSION=$(npm pkg get version | tr -d '"')
30+
if [ "$CURRENT_VERSION" != "$VERSION" ]; then
31+
npm version $VERSION --no-git-tag-version
32+
else
33+
echo "Version already set to $VERSION, skipping npm version command"
34+
fi
35+
36+
- name: publish
37+
run: |
38+
npm publish --access public

0 commit comments

Comments
 (0)