From 330f19aa898a995ff77a82ab37b2da8a44d8acbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=AD=20Malek?= Date: Wed, 31 Jan 2024 16:43:59 +0100 Subject: [PATCH] ci: simplify generate release notes step --- .github/workflows/library.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/library.yml b/.github/workflows/library.yml index a1080c14..0e6352b2 100644 --- a/.github/workflows/library.yml +++ b/.github/workflows/library.yml @@ -40,26 +40,25 @@ jobs: node-version: 18 - name: Install dependencies uses: bahmutov/npm-install@v1 - - name: Preview release - id: semantic-release + - name: Generate release notes + id: generate-release-notes run: | # locally get to the result of merging the current branch into the base branch (destination) git checkout -b ${{ github.base_ref }} ${{ github.event.after }} - unset GITHUB_ACTIONS; npx semantic-release --no-ci --dry-run > output.txt - OUTPUT=$(cat output.txt | base64 -w 0) - echo "::set-output name=releaseNote::$OUTPUT" - # echo "releaseNote=$OUTPUT" >> $GITHUB_OUTPUT + unset GITHUB_ACTIONS + RELEASE_NOTES=$(npx semantic-release --no-ci --dry-run | base64 -w 0) + echo "releaseNotes=$RELEASE_NOTES" >> $GITHUB_OUTPUT env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Report semantic release in PR uses: actions/github-script@v3 - if: ${{ steps.semantic-release.outputs.releaseNote != '' }} + if: ${{ steps.generate-release-notes.outputs.releaseNotes != '' }} with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | // build release note - const semanticReleaseOutput = Buffer.from('${{ steps.semantic-release.outputs.releaseNote }}', 'base64').toString('utf8'); + const semanticReleaseOutput = Buffer.from('${{ steps.generate-release-notes.outputs.releaseNotes }}', 'base64').toString('utf8'); const semanticReleaseLogMatch = /^[[0-9:\sAMPM]+\]\s\[semantic-release\].*$/; const lines = semanticReleaseOutput.split('\n'); const lastSemanticReleaseLogIndex = [...lines]