From 78959014dae1a05b403b2251f84bf11fcf3952ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oliver=20Sch=C3=BCrch?= Date: Wed, 28 Aug 2024 08:10:23 +0200 Subject: [PATCH] fix: release workflow (#3473) --- .github/workflows/release.yaml | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3e1e2d7334..f590d63c39 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,20 +25,23 @@ jobs: # This will fail the build if something in the publish setup is not correct # before changeset magic is starting to run - name: Test publish step - run: pnpm -r publish --dry-run + run: | + branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); - - name: Get Release Tag - id: release-tag - uses: actions/github-script@v7 - env: - REF_NAME: ${{ github.ref_name }} - with: - script: | - if (process.env.REF_NAME !== 'main') { - return ` -- --tag ${process.env.REF_NAME.split('/').pop()}`; - } else { - return ''; - } + if [[ $branch != \"main\" ]]; + then pnpm -r publish --publish-branch $branch --tag ${branch:8:2} --dry-run; + else pnpm -r publish --dry-run; + fi; + + - name: Get publish command + id: command + run: | + branch=$(git rev-parse --symbolic-full-name --abbrev-ref HEAD); + + if [[ $branch != \"main\" ]]; + then echo "publish=pnpm changeset publish --tag ${branch:8:2}" >> "$GITHUB_OUTPUT"; + else echo "publish=pnpm changeset:publish" >> "$GITHUB_OUTPUT"; + fi; # The changeset action will behave differently based on whether there are # new changesets on the github.ref branch: @@ -54,7 +57,7 @@ jobs: with: title: 'chore(changesets): 🦋📦 publish packages (${{ github.ref_name }})' commit: 'chore(changesets): publish packages' - publish: pnpm changeset:publish${{ steps.release-tag.outputs.result }} + publish: ${{ steps.command.outputs.publish }} version: pnpm changeset:version - name: Create Summary