Skip to content

Commit

Permalink
use dynamic branch for changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
dskvr committed Sep 10, 2024
1 parent ae5aa50 commit e47be26
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,24 @@ 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: |
# Check if any packages need to be version bumped
if yarn changeset status; then
echo "should_publish=true" >> "$GITHUB_OUTPUT"
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
else
echo "Base branch not found."
echo "should_publish=false" >> "$GITHUB_OUTPUT"
fi
Expand All @@ -50,6 +61,7 @@ jobs:
git add .
git commit -m "Version bumped by Changesets"
git push origin next
publish:
needs: versioning
runs-on: ubuntu-latest
Expand Down

0 comments on commit e47be26

Please sign in to comment.