1
1
name : Test and publish to NPM
2
2
on :
3
3
push :
4
- # Sequence of patterns matched against refs/tags
5
4
tags :
6
- - ' v*' # Push events to matching v*, i.e. v1.0, v20.15.10
5
+ - ' v*'
7
6
jobs :
8
7
build :
9
8
runs-on : ubuntu-latest
10
9
steps :
11
- - uses : actions/checkout@v2
12
- # Setup .npmrc file to publish to npm
13
- - uses : actions/setup-node@v2
10
+ - uses : actions/checkout@v3
11
+
12
+ - uses : actions/setup-node@v3
14
13
with :
15
- node-version : ' 16 .x'
14
+ node-version : ' 18 .x'
16
15
registry-url : ' https://registry.npmjs.org'
17
- - run : npm install
18
- - run : npm test
19
- - run : npm publish
16
+
17
+ - name : Install dependencies
18
+ run : npm ci
19
+
20
+ - name : Run tests
21
+ run : npm test
22
+
23
+ - name : Publish to NPM
24
+ run : npm publish
20
25
env :
21
26
NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
22
- # Use action slack
23
- - uses : 8398a7/action-slack@v3
27
+
28
+ - name : Slack Notification
29
+ uses : 8398a7/action-slack@v3
24
30
with :
25
31
status : ${{ job.status }}
26
- fields : repo,message,commit,author,action,eventName,ref,job,took,workflow # selectable (default: repo,message)
32
+ fields : repo,message,commit,author,action,eventName,ref,job,took
33
+ mention : ' here'
34
+ if_mention : failure,cancelled
35
+ text : |
36
+ Deploy ${{ job.status }}
37
+ Repository: ${{ github.repository }}
38
+ Commit: ${{ github.sha }}
27
39
env :
28
- SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }} # required
29
- if : always() # Pick up events even if the job fails or is canceled.
40
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
41
+ if : always()
0 commit comments