Skip to content

Commit 0f08e08

Browse files
committed
Add publish.yml
1 parent 602bdc4 commit 0f08e08

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Publish package on NPM
2+
3+
on:
4+
push:
5+
tags:
6+
- v* # Any version tag
7+
8+
permissions:
9+
id-token: write # To publish on NPM with provenance and to federate tokens
10+
contents: read # To read the package.json file
11+
12+
jobs:
13+
# Requires an approval
14+
npm-publish:
15+
runs-on: ubuntu-latest
16+
environment: npm
17+
steps:
18+
- uses: actions/checkout@v6
19+
- uses: actions/setup-node@v6
20+
with:
21+
node-version: 24
22+
registry-url: "https://registry.npmjs.org"
23+
- run: npm install
24+
- run: npm publish
25+
- uses: actions/github-script@v7
26+
with:
27+
script: |
28+
const tag = context.ref.replace('refs/tags/', '');
29+
await github.rest.repos.createRelease({
30+
owner: context.repo.owner,
31+
repo: context.repo.repo,
32+
tag_name: tag,
33+
name: tag,
34+
generate_release_notes: true,
35+
});

0 commit comments

Comments
 (0)