Skip to content

Fix hotfix_branch_6 (#115) #66

Fix hotfix_branch_6 (#115)

Fix hotfix_branch_6 (#115) #66

# 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: Create tag
- uses: anothrNick/github-tag-action@v1
env:
GITHUB_TOKEN: ${{ github.token }}
WITH_V: true
PRERELEASE: false