Skip to content

Commit 2fee9f0

Browse files
authored
Merge pull request #406 from toddbluhm/feat-github-release-action
Create Github NPM Publish Action
2 parents 660f3e0 + b75be00 commit 2fee9f0

2 files changed

Lines changed: 56 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: release
2+
3+
# Run action on every commit to main, release only when requested through commit annotation.
4+
on:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
publish-npm:
10+
runs-on: ubuntu-latest
11+
12+
env:
13+
HUSKY: 0
14+
NODE_VERSION: 24.x
15+
16+
permissions:
17+
id-token: write # Required to mint token for npm package provenance
18+
contents: write # Needed to create and write release notes in GitHub release
19+
20+
steps:
21+
- name: Checkout Project
22+
uses: actions/checkout@v4
23+
with:
24+
fetch-depth: 0
25+
26+
- name: Use Node.js ${{ env.NODE_VERSION }}
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ env.NODE_VERSION }}
30+
31+
- name: Install Dependencies
32+
run: npm install
33+
34+
- name: Lint Files
35+
run: npm run lint
36+
37+
- name: Build Project
38+
run: npm run build
39+
40+
- name: Run Tests
41+
env:
42+
CI: true
43+
run: npm run test
44+
45+
- name: Publish to NPM
46+
uses: JS-DevTools/npm-publish@v3
47+
with:
48+
token: ${{ secrets.NPM_TOKEN }}
49+
provenance: true

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,5 +84,12 @@
8484
"text",
8585
"lcov"
8686
]
87+
},
88+
"release": {
89+
"branches": ["master"],
90+
"tagFormat": "${version}"
91+
},
92+
"publishConfig": {
93+
"provenance": true
8794
}
8895
}

0 commit comments

Comments
 (0)