Skip to content

Commit d983437

Browse files
committed
fix: auto publish
1 parent 783dd0e commit d983437

File tree

4 files changed

+8450
-51
lines changed

4 files changed

+8450
-51
lines changed

.github/workflows/publish-node.js.yml

+23-27
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,29 @@
1-
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
1+
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
22
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
4-
name: Publish
3+
name: Publish npm Package
54

65
on:
7-
release:
8-
types: [published]
9-
jobs:
10-
publish:
6+
push:
7+
branches:
8+
- master
119

10+
jobs:
11+
publish-npm:
1212
runs-on: ubuntu-latest
13-
1413
steps:
15-
- uses: actions/checkout@v2
16-
with:
17-
ref: ${{ github.event.release.target_commitish }}
18-
- uses: actions/setup-node@v2
19-
with:
20-
node-version: 16
21-
cache: 'npm'
22-
- run: git config --global user.name "GitHub CD bot"
23-
- run: git config --global user.email "[email protected]"
24-
- run: npm version ${{ github.event.release.tag_name }}
25-
- uses: JS-DevTools/npm-publish@v1
26-
with:
27-
token: ${{ secrets.NPM_TOKEN }}
28-
29-
# push the version changes to GitHub
30-
- run: git push
31-
env:
32-
# The secret is passed automatically. Nothing to configure.
33-
github-token: ${{ secrets.GITHUB_TOKEN }}
14+
- uses: actions/checkout@v3
15+
- uses: actions/setup-node@v3
16+
with:
17+
node-version: 20
18+
registry-url: https://registry.npmjs.org/
19+
- run: git config --global user.name "GitHub CD bot"
20+
- run: git config --global user.email "[email protected]"
21+
- run: 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
27+
env:
28+
# The secret is passed automatically. Nothing to configure.
29+
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/run-tests.yml

+12-5
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
11
name: Run Tests
22

3-
on: [push]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- main
8+
pull_request:
9+
branches:
10+
- '**'
411

512
jobs:
613
build:
714

815
runs-on: ubuntu-latest
916

1017
steps:
11-
- uses: actions/checkout@v2
12-
- name: Use Node.js 14
13-
uses: actions/setup-node@v1
18+
- uses: actions/checkout@v3
19+
- name: Setup nodejs
20+
uses: actions/setup-node@v3
1421
with:
15-
node-version: 14
22+
node-version: 20
1623
- run: npm i
1724
- run: npm run test
1825
- run: npm run test-integration

0 commit comments

Comments
 (0)