-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (61 loc) · 1.9 KB
/
merge_hotfix_to_dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# 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