1- # This action is centrally managed in https://github.com/asyncapi/.github/
2- # Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in above mentioned repo
3-
4- # It does magic only if there is package.json file in the root of the project
5- name : Release - if Node project
1+ # It does magic only if there is a package.json file in the root of the project
2+ name : Release
63
74on :
85 push :
96 branches :
107 - master
11- # below lines are not enough to have release supported for these branches
12- # make sure configuration of `semantic-release` package mentions these branches
8+ # The below lines are not enough to have release supported for these branches
139 - next-spec
1410 - next-major
1511 - next-major-spec
1814 - next
1915
2016jobs :
21-
2217 test-nodejs :
23- # We just check the message of first commit as there is always just one commit because we squash into one before merging
24- # "commits" contains array of objects where one of the properties is commit "message"
18+ # We just check the message of the first commit as there is always just one commit because we squash into one before merging
19+ # "commits" contains an array of objects where one of the properties is the commit "message"
2520 # Release workflow will be skipped if release conventional commits are not used
2621 if : |
27- startsWith( github.repository, 'asyncapi/' ) &&
22+ startsWith( github.repository, 'asyncapi/' ) &&
2823 (startsWith( github.event.commits[0].message , 'fix:' ) ||
2924 startsWith( github.event.commits[0].message, 'fix!:' ) ||
3025 startsWith( github.event.commits[0].message, 'feat:' ) ||
26+ startsWith( github.event.commits[0].message, 'chore(release):' ) ||
3127 startsWith( github.event.commits[0].message, 'feat!:' ))
3228 name : Test NodeJS release on ${{ matrix.os }}
3329 runs-on : ${{ matrix.os }}
3430 strategy :
3531 matrix :
36- # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
32+ # Using macos-13 instead of latest (macos-14) due to an issue with Puppeteer and such runner.
3733 # See: https://github.com/puppeteer/puppeteer/issues/12327 and https://github.com/asyncapi/parser-js/issues/1001
3834 os : [ubuntu-latest, macos-13, windows-latest]
3935 steps :
40- - name : Set git to use LF # to once and for all finish neverending fight between Unix and Windows
36+ - name : Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows
4137 run : |
4238 git config --global core.autocrlf false
4339 git config --global core.eol lf
6056 - if : steps.lockversion.outputs.version == '18' && matrix.os == 'windows-latest'
6157 name : Install npm cli 8
6258 shell : bash
63- # npm cli 10 is buggy because of some cache issues
59+ # npm cli 10 is buggy because of some cache issues
6460 run : npm install -g npm@8.19.4
6561 - if : steps.packagejson.outputs.exists == 'true'
6662 name : Install dependencies
@@ -75,16 +71,16 @@ jobs:
7571 with :
7672 status : ${{ job.status }}
7773 fields : repo,action,workflow
78- text : ' Release workflow failed in testing job'
74+ text : " Release workflow failed in testing job"
7975 env :
8076 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
8177
8278 release :
8379 needs : [test-nodejs]
84- name : Publish to any of NPM, Github , or Docker Hub
80+ name : Publish to any of NPM, GitHub , or Docker Hub
8581 runs-on : ubuntu-latest
8682 steps :
87- - name : Set git to use LF # to once and for all finish neverending fight between Unix and Windows
83+ - name : Set git to use LF # To once and for all finish the never-ending fight between Unix and Windows
8884 run : |
8985 git config --global core.autocrlf false
9086 git config --global core.eol lf
@@ -108,27 +104,35 @@ jobs:
108104 shell : bash
109105 run : npm ci
110106 - if : steps.packagejson.outputs.exists == 'true'
111- name : Add plugin for conventional commits for semantic-release
112- run : npm install --save-dev conventional-changelog-conventionalcommits@5.0.0
107+ name : Install changelog
108+ shell : bash
109+ # This step can be removed once the issue is fixed in the changeset package.
110+ run : npm install @changesets/changelog-git@0.2.0
111+
113112 - if : steps.packagejson.outputs.exists == 'true'
114113 name : Publish to any of NPM, Github, and Docker Hub
114+ # this step has 2 goals, it is either identifying that there is changeset file created and then this action creates a PR with version bump that will trigger release - or if it sees there is no changeset, and there are versions changes in package.json files, it publish new versions to NPM is they are not there yet
115+ uses : changesets/action@v1
115116 id : release
117+ with :
118+ version : npm run bump:version
119+ commit : " chore(release): release and bump versions of packages"
120+ title : " chore(release): release and bump versions of packages"
121+ publish : npx -p @changesets/cli@2.27.7 changeset publish
122+ setupGitUser : false
116123 env :
117124 GITHUB_TOKEN : ${{ secrets.GH_TOKEN }}
118125 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
119- DOCKER_USERNAME : ${{ secrets.DOCKER_USERNAME }}
120- DOCKER_PASSWORD : ${{ secrets.DOCKER_PASSWORD }}
121126 GIT_AUTHOR_NAME : asyncapi-bot
122127 GIT_AUTHOR_EMAIL : info@asyncapi.io
123128 GIT_COMMITTER_NAME : asyncapi-bot
124129 GIT_COMMITTER_EMAIL : info@asyncapi.io
125- run : npx semantic-release@19.0.4
126- - if : failure() # Only, on failure, send a message on the 94_bot-failing-ci slack channel
130+ - if : failure() # Only, on failure, send a message on the 94_bot-failing-ci Slack channel
127131 name : Report workflow run status to Slack
128132 uses : 8398a7/action-slack@v3
129133 with :
130134 status : ${{ job.status }}
131135 fields : repo,action,workflow
132- text : ' Release workflow failed in release job'
136+ text : " Release workflow failed in release job"
133137 env :
134138 SLACK_WEBHOOK_URL : ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
0 commit comments