Add hotfix_branch_9 #69
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
# merges the master branch after a hotfix branch | |
# has been merged into the master branch and then | |
# creates a tag | |
name: merge-hotfix-branch | |
on: | |
pull_request: | |
branches: [master] | |
types: [closed] | |
jobs: | |
check-branch: | |
name: check-branch | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set contains_hotfix var | |
run: echo "contains_hotfix=0" >> $GITHUB_OUTPUT | |
- name: Check branch name | |
id: search_hotfix | |
shell: bash | |
run: | | |
if [[ $GITHUB_HEAD_REF == *"hotfix_"* ]]; then | |
echo "Branch name has hotfix_ prefix" | |
echo "contains_hotfix=1" >> $GITHUB_OUTPUT | |
else | |
echo "Branch name does not have hotfix_ prefix" | |
fi | |
- name: Fail if not hotfix | |
shell: bash | |
if: github.base_ref == 'master' && github.head_ref != 'develop' && steps.search_hotfix.outputs.contains_hotfix == 0 | |
run: | | |
echo "ERROR: You can only merge to main branch from develop branch or a hotfix_ branch." | |
exit 1 | |
merge-master-to-dev: | |
name: merge-master-to-dev | |
runs-on: ubuntu-latest | |
needs: check-branch | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Merge master to develop | |
uses: mtanzi/action-automerge@v1 | |
id: merge | |
with: | |
github_token: ${{ github.token }} | |
source: 'master' | |
target: 'develop' | |
bump-version-and-push-tag: | |
name: bump-version-and-push-tag | |
runs-on: ubuntu-latest | |
needs: [check-branch, merge-master-to-dev] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: Create tag | |
uses: anothrNick/github-tag-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
WITH_V: true | |
PRERELEASE: false | |
DEFAULT_BUMP: patch | |