File tree Expand file tree Collapse file tree 2 files changed +61
-40
lines changed Expand file tree Collapse file tree 2 files changed +61
-40
lines changed Original file line number Diff line number Diff line change 1+ name : Create tag
2+
3+ on :
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+
16+ push :
17+ branches :
18+ - main
19+ paths :
20+ - ' package.json'
21+ - ' index.js'
22+
23+ jobs :
24+ create-tag :
25+ runs-on : ubuntu-latest
26+
27+ steps :
28+ - name : Checkout code
29+ uses : actions/checkout@v5
30+ with :
31+ token : ${{ secrets.GH_PUSH_TOKEN }}
32+
33+ - name : Set up Node.js
34+ uses : actions/setup-node@v6
35+ with :
36+ node-version : ' 22'
37+ registry-url : ' https://registry.npmjs.org'
38+
39+ - name : Update npm
40+ run : npm install -g npm@latest
41+
42+ - name : Install dependencies
43+ run : npm install
44+
45+ - name : Verifying provenance attestations
46+ run : npm audit signatures
47+
48+ - name : Bump version and create tag
49+ run : |
50+ git config --global user.name "github-actions[bot]"
51+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
52+ npm version ${{ github.event.inputs.bump || 'minor' }} -m "Release %s"
53+
54+ - name : Dry run publishing to npm
55+ run : npm publish --dry-run --provenance --access=public
56+
57+ - name : Push to GitHub
58+ run : git push origin main --follow-tags
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-
164 push :
17- branches :
18- - main
19- paths :
20- - ' package.json'
21- - ' index.js'
5+ tags :
6+ - ' v*'
227
238permissions :
249 id-token : write
@@ -31,41 +16,19 @@ jobs:
3116 steps :
3217 - name : Checkout code
3318 uses : actions/checkout@v5
34- with :
35- token : ${{ secrets.GH_PUSH_TOKEN }}
3619
3720 - name : Set up Node.js
3821 uses : actions/setup-node@v6
3922 with :
4023 node-version : ' 22'
4124 registry-url : ' https://registry.npmjs.org'
4225
43- - name : Update npm
44- run : npm install -g npm@latest
45-
46- - name : Install dependencies
47- run : npm install
48-
49- - name : Verifying provenance attestations
50- run : npm audit signatures
51-
52- - name : Bump version and create tag
53- id : bump-version
54- run : |
55- git config --global user.name "github-actions[bot]"
56- git config --global user.email "github-actions[bot]@users.noreply.github.com"
57- TAG=$(npm version ${{ github.event.inputs.bump || 'minor' }} -m "Release %s [skip ci]")
58- echo "Created tag: $TAG"
59- echo "tag=$TAG" >> "$GITHUB_OUTPUT"
60- git push origin main --follow-tags
61-
6226 - name : Publish to npm
63- run : npm publish --provenance --access=public
27+ run : npm publish --dry-run -- provenance --access=public
6428
6529 - name : Create GitHub Release
6630 uses : softprops/action-gh-release@v2
6731 with :
68- tag_name : ${{ steps.bump-version.outputs.tag }}
6932 generate_release_notes : true
7033 env :
7134 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments