Skip to content

Commit

Permalink
deploy wf: fix changeset + only run publish if changeset exists
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Sep 10, 2024
1 parent e47be26 commit 3ab2cff
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -64,6 +53,7 @@ jobs:
publish:
needs: versioning
if: needs.versioning.outputs.should_publish == 'true'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down

0 comments on commit 3ab2cff

Please sign in to comment.