Skip to content

Commit

Permalink
ci: warning instead exit 1
Browse files Browse the repository at this point in the history
Updates the actions to use node 20 versions and avoids exit 1 that makes
it seem like something went wrong in the case of an error.
  • Loading branch information
TiborUdvari committed Sep 13, 2024
2 parents 4fa7718 + 5e52289 commit fcc833f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '20'
registry-url: 'https://registry.npmjs.org'
Expand All @@ -30,26 +30,32 @@ jobs:
- name: Check for release notes
run: |
RELEASE_NOTES="$(npm run release -- --dry-run | awk 'BEGIN { flag=0 } /^---$/ { if (flag == 0) { flag=1 } else { flag=2 }; next } flag == 1')"
echo "RELEASE_NOTES: $RELEASE_NOTES"
# Don't release if there are no changes
if [ "$(echo "$RELEASE_NOTES" | wc -l)" -eq 1 ] ; then
echo "This release would have no release notes. Does it include changes?"
echo "::warning::This release would have no release notes. Does it include changes?"
echo " - You must have at least one fix / feat commit to generate release notes"
echo "*** STOPPING RELEASE PROCESS ***"
exit 1
echo "RELEASE_NOTES_AVAILABLE=false" >> $GITHUB_ENV
else
echo "RELEASE_NOTES_AVAILABLE=true" >> $GITHUB_ENV
fi
- name: Generate release version
if: success() && env.RELEASE_NOTES_AVAILABLE == 'true'
run: npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}

- name: Push version changes
if: success() && env.RELEASE_NOTES_AVAILABLE == 'true'
run: |
git push --follow-tags origin main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Publish package
if: success() && env.RELEASE_NOTES_AVAILABLE == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_KEY }}

0 comments on commit fcc833f

Please sign in to comment.