Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0139982

Browse files
committed
ci: add publishing workflow
1 parent 9187647 commit 0139982

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
timeout-minutes: 15
12+
permissions:
13+
contents: read
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '22'
22+
cache: 'npm'
23+
24+
- run: npm install
25+
- run: npm run lint
26+
- run: npm test
27+
28+
publish:
29+
needs: test
30+
runs-on: ubuntu-latest
31+
environment: npm-publish
32+
permissions:
33+
contents: write # Required for creating releases
34+
id-token: write # Required for provenance
35+
36+
steps:
37+
- uses: actions/checkout@v4
38+
39+
- name: Setup Node.js
40+
uses: actions/setup-node@v4
41+
with:
42+
node-version: '22'
43+
registry-url: 'https://registry.npmjs.org'
44+
cache: 'npm'
45+
46+
- name: Upgrade npm for OIDC
47+
run: npm install -g npm@latest
48+
49+
- name: Install Dependencies
50+
run: npm install
51+
52+
- name: Publish to npm
53+
run: npm publish --provenance --access public
54+
55+
- name: Create GitHub Release
56+
uses: softprops/action-gh-release@v2
57+
with:
58+
generate_release_notes: true

0 commit comments

Comments
 (0)