@@ -39,24 +39,28 @@ jobs:
39
39
git config --global core.autocrlf false
40
40
git config --global core.eol lf
41
41
- name : Checkout repository
42
- uses : actions/checkout@v2
42
+ uses : actions/checkout@v3
43
43
- name : Check if Node.js project and has package.json
44
44
id : packagejson
45
- run : test -e ./package.json && echo "::set-output name= exists:: true" || echo "::set-output name= exists:: false"
45
+ run : test -e ./package.json && echo "exists= true" >> $GITHUB_OUTPUT || echo "exists= false" >> $GITHUB_OUTPUT
46
46
shell : bash
47
+ - if : steps.packagejson.outputs.exists == 'true'
48
+ name : Check package-lock version
49
+ uses : asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
50
+ id : lockversion
47
51
- if : steps.packagejson.outputs.exists == 'true'
48
52
name : Setup Node.js
49
- uses : actions/setup-node@v2
53
+ uses : actions/setup-node@v3
50
54
with :
51
- node-version : 14
55
+ node-version : " ${{ steps.lockversion.outputs.version }} "
52
56
cache : ' npm'
53
57
cache-dependency-path : ' **/package-lock.json'
54
58
- if : steps.packagejson.outputs.exists == 'true'
55
59
name : Install dependencies
56
60
run : npm install
57
61
- if : steps.packagejson.outputs.exists == 'true'
58
62
name : Run test
59
- run : npm test
63
+ run : npm test --if-present
60
64
- if : failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
61
65
name : Report workflow run status to Slack
62
66
uses : 8398a7/action-slack@v3
@@ -69,26 +73,35 @@ jobs:
69
73
70
74
release :
71
75
needs : [test-nodejs]
72
- name : Publish to any of NPM, Github, and Docker Hub
76
+ name : Publish to any of NPM, Github, or Docker Hub
73
77
runs-on : ubuntu-latest
74
78
steps :
75
79
- name : Set git to use LF # to once and for all finish neverending fight between Unix and Windows
76
80
run : |
77
81
git config --global core.autocrlf false
78
82
git config --global core.eol lf
79
83
- name : Checkout repository
80
- uses : actions/checkout@v2
84
+ uses : actions/checkout@v3
81
85
- name : Check if Node.js project and has package.json
82
86
id : packagejson
83
- run : test -e ./package.json && echo "::set-output name=exists::true" || echo "::set-output name=exists::false"
87
+ run : test -e ./package.json && echo "exists=true" >> $GITHUB_OUTPUT || echo "exists=false" >> $GITHUB_OUTPUT
88
+ - if : steps.packagejson.outputs.exists == 'true'
89
+ name : Check package-lock version
90
+ uses : asyncapi/.github/.github/actions/get-node-version-from-package-lock@master
91
+ id : lockversion
84
92
- if : steps.packagejson.outputs.exists == 'true'
85
93
name : Setup Node.js
86
- uses : actions/setup-node@v1
94
+ uses : actions/setup-node@v3
87
95
with :
88
- node-version : 14
96
+ node-version : " ${{ steps.lockversion.outputs.version }}"
97
+ cache : ' npm'
98
+ cache-dependency-path : ' **/package-lock.json'
89
99
- if : steps.packagejson.outputs.exists == 'true'
90
100
name : Install dependencies
91
101
run : npm install
102
+ - if : steps.packagejson.outputs.exists == 'true'
103
+ name : Add plugin for conventional commits for semantic-release
104
+ run : npm install --save-dev conventional-changelog-conventionalcommits@5.0.0
92
105
- if : steps.packagejson.outputs.exists == 'true'
93
106
name : Publish to any of NPM, Github, and Docker Hub
94
107
id : release
@@ -101,7 +114,7 @@ jobs:
101
114
GIT_AUTHOR_EMAIL : info@asyncapi.io
102
115
GIT_COMMITTER_NAME : asyncapi-bot
103
116
GIT_COMMITTER_EMAIL : info@asyncapi.io
104
- run : npm run release
117
+ run : npx semantic- release@19.0.4
105
118
- if : failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
106
119
name : Report workflow run status to Slack
107
120
uses : 8398a7/action-slack@v3
@@ -110,4 +123,4 @@ jobs:
110
123
fields : repo,action,workflow
111
124
text : ' Release workflow failed in release job'
112
125
env :
113
- SLACK_WEBHOOK_URL : ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
126
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
0 commit comments