Skip to content

Commit

Permalink
Fix bump workflow by explicitly using if construct (#432)
Browse files Browse the repository at this point in the history
  • Loading branch information
yubiuser authored Feb 25, 2025
2 parents 48291ad + 2170d51 commit 47bd6c6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions .github/workflows/version_bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ jobs:
LATEST_TAG=$(gh -R $REPO release list -L 1 | awk '{printf $3}')
echo "Latest version tag for releases in $REPO is $LATEST_TAG"
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
[[ -z ${LATEST_TAG} ]] && echo "Error: LATEST_TAG is empty, aborting" && exit 1
# Exit when LATEST_TAG is empty, due to github connection errors
if [[ -z "${LATEST_TAG}" ]]; then echo "Error: LATEST_TAG is empty, aborting" && exit 1; fi;
shell: bash

- name: Checkout code
uses: actions/[email protected]
Expand All @@ -28,14 +30,16 @@ jobs:
run: |
LATEST_TAG=${{ env.latest_tag }}
REMOTE_BRANCH=$(git ls-remote --heads origin "bump_$LATEST_TAG")
[[ -z ${REMOTE_BRANCH} ]] && echo "branch_exists=false" >> $GITHUB_ENV || echo "branch_exists=true" >> $GITHUB_ENV
[[ -z ${REMOTE_BRANCH} ]] && echo "Remote branch bump_$LATEST_TAG does not exist" || echo "Remote branch bump_$LATEST_TAG already exists"
[[ -z "${REMOTE_BRANCH}" ]] && echo "branch_exists=false" >> $GITHUB_ENV || echo "branch_exists=true" >> $GITHUB_ENV
[[ -z "${REMOTE_BRANCH}" ]] && echo "Remote branch bump_$LATEST_TAG does not exist" || echo "Remote branch bump_$LATEST_TAG already exists"
shell: bash

- name: Get current version
run: |
CURRENT_VERSION=$(cat padd.sh | grep '^padd_version=' | cut -d'"' -f 2)
echo "Current PADD version is $CURRENT_VERSION"
echo "current_version=$CURRENT_VERSION" >> $GITHUB_ENV
shell: bash

- name: Create PR if versions don't match and branch does not exist
if: (env.current_version != env.latest_tag) && (env.branch_exists == 'false')
Expand All @@ -48,3 +52,4 @@ jobs:
git commit -a -m "Bump version to $LATEST_TAG"
git push --set-upstream origin "bump_$LATEST_TAG"
gh pr create -B development -H "bump_$LATEST_TAG" --title "Bump version to ${LATEST_TAG}" --body 'Created by Github action' --label 'Internal'
shell: bash

0 comments on commit 47bd6c6

Please sign in to comment.