From bbfd496198e3930e3c30b4f675043a86dcf09a54 Mon Sep 17 00:00:00 2001 From: Trezy Date: Thu, 1 Aug 2024 10:34:29 -0500 Subject: [PATCH] ci: retrieve next version from the real release attempt This allows us to see the output of `semantic-release` while also capturing the version and exporting it for use in future steps. --- .github/workflows/handle-release-branch-push.yml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.github/workflows/handle-release-branch-push.yml b/.github/workflows/handle-release-branch-push.yml index 88758c53..9488b4d1 100644 --- a/.github/workflows/handle-release-branch-push.yml +++ b/.github/workflows/handle-release-branch-push.yml @@ -47,25 +47,18 @@ jobs: run: npm run build shell: bash - - name: Get Next Release Version + - name: Semantic Release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - id: get_release_version + id: release run: | - export NEXT_TAG_VERSION=$(npx semantic-release --dry-run | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') + export NEXT_TAG_VERSION=$(npx semantic-release | grep 'The next release version is' | sed -E 's/.* ([[:digit:].]+)$/\1/') echo "new_tag_version=${NEXT_TAG_VERSION}" >> $GITHUB_OUTPUT shell: bash - - name: Semantic Release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} - run: npx semantic-release - shell: bash - - name: Publish to npm env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - if: ${{ steps.get_release_version.outputs.new_tag_version != '' }} + if: ${{ steps.release.outputs.new_tag_version != '' }} run: npm publish ./dist/*.tgz --tag ${{ (github.head_ref || github.ref_name) == 'main' && 'latest' || github.head_ref || github.ref_name }} shell: bash