File tree Expand file tree Collapse file tree 3 files changed +41
-57
lines changed Expand file tree Collapse file tree 3 files changed +41
-57
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11name : Publish to npm
22
33on :
4+ workflow_dispatch :
5+ inputs :
6+ bump :
7+ description : ' Version bump type'
8+ required : true
9+ default : ' minor'
10+ type : choice
11+ options :
12+ - patch
13+ - minor
14+ - major
15+
416 push :
5- tags :
6- - ' v*'
17+ branches :
18+ - main
19+ paths :
20+ - ' package.json'
21+ - ' index.js'
722
823permissions :
924 id-token : write
@@ -16,19 +31,42 @@ jobs:
1631 steps :
1732 - name : Checkout code
1833 uses : actions/checkout@v5
34+ with :
35+ token : ${{ secrets.GH_PUSH_TOKEN }}
1936
2037 - name : Set up Node.js
2138 uses : actions/setup-node@v6
2239 with :
2340 node-version : ' 22'
2441 registry-url : ' https://registry.npmjs.org'
42+ cache : ' npm'
43+
44+ - name : Update npm
45+ run : npm install -g npm@latest
46+
47+ - name : Install dependencies
48+ run : npm install
49+
50+ - name : Verifying provenance attestations
51+ run : npm audit signatures
52+
53+ - name : Bump version and create tag
54+ id : bump-version
55+ run : |
56+ git config --global user.name "github-actions[bot]"
57+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
58+ TAG=$(npm version ${{ github.event.inputs.bump || 'minor' }} -m "Release %s [skip ci]")
59+ echo "Created tag: $TAG"
60+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
61+ git push origin main --follow-tags
2562
2663 - name : Publish to npm
2764 run : npm publish --provenance --access=public
2865
2966 - name : Create GitHub Release
3067 uses : softprops/action-gh-release@v2
3168 with :
69+ tag_name : ${{ steps.bump-version.outputs.tag }}
3270 generate_release_notes : true
3371 env :
3472 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 3939 uses : actions/setup-node@v6
4040 with :
4141 node-version : ' 22'
42+ cache : ' npm'
4243
4344 - name : Update npm
4445 run : npm install -g npm@latest
You can’t perform that action at this time.
0 commit comments