diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69af22a..65ff7ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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' @@ -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 }}