From 3ab2cff702113256a1d646107358cf0d02c286a0 Mon Sep 17 00:00:00 2001 From: dskvr Date: Tue, 10 Sep 2024 12:51:28 +0200 Subject: [PATCH] deploy wf: fix changeset + only run publish if changeset exists --- .github/workflows/publish-package.yml | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 3a1dcaf2..bdcd4f9e 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -27,24 +27,13 @@ jobs: - name: Install Dependencies run: yarn install --frozen-lockfile - - name: Get Base Branch - id: get_base_branch - run: | - BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@') - echo "base_branch=$BASE_BRANCH" >> "$GITHUB_OUTPUT" - - name: Check for Changeset Version Bump id: publish_check run: | - BASE_BRANCH="${{ steps.get_base_branch.outputs.base_branch }}" - if git show-ref --verify --quiet "refs/heads/$BASE_BRANCH"; then - if yarn changeset status --since=$BASE_BRANCH; then - echo "should_publish=true" >> "$GITHUB_OUTPUT" - else - echo "should_publish=false" >> "$GITHUB_OUTPUT" - fi + # Check if there are changesets that need version bumping + if yarn changeset status --since="${{ github.ref_name }}"; then + echo "should_publish=true" >> "$GITHUB_OUTPUT" else - echo "Base branch not found." echo "should_publish=false" >> "$GITHUB_OUTPUT" fi @@ -64,6 +53,7 @@ jobs: publish: needs: versioning + if: needs.versioning.outputs.should_publish == 'true' runs-on: ubuntu-latest strategy: fail-fast: false