Fix Option
printing (#855)
#541
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: 'Bump Release' | |
on: | |
push: | |
branches: | |
- 'master' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
version-bump: | |
name: 'Version Bump and Start Release' | |
runs-on: ubuntu-latest | |
steps: | |
- name: 'Check out code' | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.JENKINS_GITHUB_PAT }} | |
# fetch-depth 0 means deep clone the repo | |
fetch-depth: 0 | |
- name: 'Configure GitHub user' | |
run: | | |
git config user.name rv-jenkins | |
git config user.email [email protected] | |
- name: 'Update version' | |
run: | | |
# Check out the release branch and create it if it doesn't exist | |
git checkout -B release origin/release | |
# Get the common ancestor commit between master and release branches | |
old_master="$(git merge-base origin/master origin/release)" | |
# Get the latest commit hash on the master branch | |
new_master="$(git rev-parse origin/master)" | |
# Check if there are changes in the package/version file between the common ancestor and the latest master commit | |
if git diff --exit-code ${old_master} ${new_master} -- package/version; then | |
# If there are no changes, bump the version based on the current version in master | |
git merge --no-edit origin/master | |
./package/version.sh bump | |
else | |
# If there are changes, merge master into release with 'theirs' strategy to resolve conflicts | |
git merge --no-edit --strategy-option=theirs origin/master | |
fi | |
# Substitute the version in the package/version file | |
./package/version.sh sub | |
# Add changes to the staging area and commit them if there are any changes | |
if git add --update && git commit --no-edit --allow-empty --message "Set Version: $(cat package/version)"; then | |
# Push the changes to the release branch -- Trigger the Release Process and Testing | |
git push origin release | |
git tag "release-$(cat package/version)" origin/master | |
git push origin "release-$(cat package/version)" | |
fi |