feat(github action): added npm release github action

release-npm

fix(release): use new npm publish github action

Only publish to npm if the semver version is different from npm

fix(workflow): update release workflow to improve clarity
This commit is contained in:
Todd Bluhm 2025-07-02 02:05:54 -08:00
parent 660f3e0a06
commit b75be00e9f
No known key found for this signature in database
GPG Key ID: 9CF312607477B8AB
2 changed files with 56 additions and 0 deletions

49
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: release
# Run action on every commit to main, release only when requested through commit annotation.
on:
push:
branches: [master]
jobs:
publish-npm:
runs-on: ubuntu-latest
env:
HUSKY: 0
NODE_VERSION: 24.x
permissions:
id-token: write # Required to mint token for npm package provenance
contents: write # Needed to create and write release notes in GitHub release
steps:
- name: Checkout Project
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install Dependencies
run: npm install
- name: Lint Files
run: npm run lint
- name: Build Project
run: npm run build
- name: Run Tests
env:
CI: true
run: npm run test
- name: Publish to NPM
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
provenance: true

View File

@ -84,5 +84,12 @@
"text",
"lcov"
]
},
"release": {
"branches": ["master"],
"tagFormat": "${version}"
},
"publishConfig": {
"provenance": true
}
}