File tree Expand file tree Collapse file tree 1 file changed +16
-26
lines changed Expand file tree Collapse file tree 1 file changed +16
-26
lines changed Original file line number Diff line number Diff line change 1
- # This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2
- # For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3
-
4
- name : Node.js Package
1
+ name : Publish npm Package
5
2
6
3
on :
7
- release :
8
- types : [created]
4
+ push :
5
+ branches :
6
+ - master
7
+ - main
9
8
10
9
jobs :
11
- build :
12
- runs-on : ubuntu-latest
13
- steps :
14
- - uses : actions/checkout@v4
15
- - uses : actions/setup-node@v4
16
- with :
17
- node-version : 20
18
- - run : npm test
19
-
20
10
publish-npm :
21
- needs : build
22
11
runs-on : ubuntu-latest
23
12
steps :
24
13
- uses : actions/checkout@v4
25
14
- uses : actions/setup-node@v4
26
15
with :
27
16
node-version : 20
28
17
registry-url : https://registry.npmjs.org/
29
-
30
- - name : Get release name
31
- run : echo "RELEASE_NAME=${{ github.event.release.name }}" >> $GITHUB_ENV
32
-
33
- - name : Update package.json version
34
- run : |
35
- npm version ${{ env.RELEASE_NAME }} --no-git-tag-version
36
-
37
- - run : npm publish
18
+ - run : git config --global user.name "GitHub CD bot"
19
+ -
run : git config --global user.email "[email protected] "
20
+ - run : npm i && npm run test
21
+ - run : npm config set access public && npx semantic-release
22
+ env :
23
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
24
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
+ # push the version changes to GitHub
26
+ - run : git add package.json && git commit -m'update version' && git push
38
27
env :
39
- NODE_AUTH_TOKEN : ${{secrets.npm_token}}
28
+ # The secret is passed automatically. Nothing to configure.
29
+ github-token : ${{ secrets.GITHUB_TOKEN }}
You can’t perform that action at this time.
0 commit comments