File tree Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Expand file tree Collapse file tree 1 file changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ name: Node.js Package
66on :
77 workflow_dispatch :
88 release :
9- types : [created]
10-
9+ types : [ created ]
10+ pull_request :
11+ types : [ review_requested ]
1112jobs :
1213 build :
1314 runs-on : ubuntu-latest
1819 node-version : 16
1920 - run : npm ci
2021
21- publish-npm :
22+ update-version :
2223 needs : build
2324 runs-on : ubuntu-latest
25+ steps :
26+ - uses : actions/checkout@v4
27+ - name : Update setup.py version
28+ run : |
29+ TAG_NAME=$(echo ${{github.ref_name}})
30+ jq --arg tag "$TAG_NAME" '.version = $tag' package.json > tmp.$$.json && mv tmp.$$.json package.json
31+
32+ - name : Commit and push changes
33+ run : |
34+ TAG_NAME=$(echo ${{github.ref_name}})
35+ git config --global user.name 'github-actions[bot]'
36+ git config --global user.email 'github-actions[bot]@users.noreply.github.com'
37+ git add package.json
38+ git commit -m "Update package.json version to $TAG_NAME"
39+ git tag -f $TAG_NAME
40+ git push --force origin $TAG_NAME
41+ env :
42+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
43+
44+ publish-npm :
45+ needs : update-version
46+ runs-on : ubuntu-latest
47+ if : startsWith(github.ref, 'refs/tags/')
2448 steps :
2549 - uses : actions/checkout@v4
2650 - uses : actions/setup-node@v3
You can’t perform that action at this time.
0 commit comments