Skip to content

Commit 699e118

Browse files
authored
Merge branch 'hotfix/1.0.1-rc.4' into develop (#11)
2 parents 9d9df91 + 6e57269 commit 699e118

File tree

3 files changed

+27
-18
lines changed

3 files changed

+27
-18
lines changed

.github/workflows/release.yaml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,16 @@ name: release
22

33
on:
44
pull_request:
5-
branches:
6-
- main
75
types:
86
- closed
7+
branches:
8+
- main
99

1010
env:
1111
BRANCH_MAIN: main
1212
BRANCH_DEVELOP: develop
13+
BRANCH_RELEASE_PREFIX: release
14+
BRANCH_HOTFIX_PREFIX: hotfix
1315
TAG_PREFIX: v
1416

1517
jobs:
@@ -20,7 +22,7 @@ jobs:
2022
contents: write
2123
# only merge pull requests that begin with 'release/' or 'hotfix/'
2224
if: github.event.pull_request.merged == true &&
23-
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/'))
25+
(startsWith(github.head_ref, '${{ env.BRANCH_RELEASE_PREFIX }}/') || startsWith(github.head_ref, '${{ env.BRANCH_HOTFIX_PREFIX }}/'))
2426

2527
steps:
2628
- name: Set GitHub token
@@ -30,21 +32,21 @@ jobs:
3032
- name: Checkout repository
3133
uses: actions/checkout@v3
3234
with:
33-
ref: ${{ github.event.pull_request.head.ref }}
35+
ref: ${{ github.head_ref }}
3436
token: ${{ env.GH_TOKEN }}
3537

3638
- name: Extract version from release branch
37-
if: startsWith(github.event.pull_request.head.ref, 'release/')
39+
if: startsWith(github.head_ref, '${{ env.BRANCH_RELEASE_PREFIX }}/')
3840
run: |
39-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
40-
VERSION=${BRANCH_NAME#release/}
41+
BRANCH_NAME="${{ github.head_ref }}"
42+
VERSION=${BRANCH_NAME#${{ env.BRANCH_RELEASE_PREFIX }}/}
4143
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
4244
4345
- name: Extract version from hotfix branch
44-
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
46+
if: startsWith(github.head_ref, '${{ env.BRANCH_HOTFIX_PREFIX }}/')
4547
run: |
46-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
47-
VERSION=${BRANCH_NAME#hotfix/}
48+
BRANCH_NAME="${{ github.head_ref }}"
49+
VERSION=${BRANCH_NAME#${{ env.BRANCH_HOTFIX_PREFIX }}/}
4850
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
4951
5052
- name: Create release
@@ -57,18 +59,18 @@ jobs:
5759
--title "${{ env.RELEASE_TAG }}" \
5860
--generate-notes
5961
60-
- name: Create merge PR ${{ github.event.pull_request.head.ref }} -> ${{ env.BRANCH_DEVELOP }}
62+
- name: Create merge PR ${{ github.head_ref }} -> ${{ env.BRANCH_DEVELOP }}
6163
env:
62-
PR_TITLE: Merge branch '${{ github.event.pull_request.head.ref }}' into ${{ env.BRANCH_DEVELOP }}
64+
PR_TITLE: Merge branch '${{ github.head_ref }}' into ${{ env.BRANCH_DEVELOP }}
6365
PR_BODY: |
64-
This PR merges the ${{ github.event.pull_request.head.ref }} branch back into ${{ env.BRANCH_DEVELOP }} branch.
65-
This happens to ensure that the updates that happened on the ${{ github.event.pull_request.head.ref }} branch, i.e. CHANGELOG and manifest updates are also present on the ${{ env.BRANCH_DEVELOP }} branch.
66-
PR_LABELS: |
67-
automated-pr
66+
This PR merges the ${{ github.head_ref }} branch back into ${{ env.BRANCH_DEVELOP }} branch.
67+
This happens to ensure that the updates that happened on the ${{ github.head_ref }} branch, i.e. CHANGELOG and manifest updates are also present on the ${{ env.BRANCH_DEVELOP }} branch.
68+
PR_LABEL: automated-pr
6869
run: |
70+
gh label create ${{ env.PR_LABEL }} --force
6971
gh pr create \
7072
--base ${{ env.BRANCH_DEVELOP }} \
71-
--head ${{ github.event.pull_request.head.ref }} \
73+
--head ${{ github.head_ref }} \
7274
--title "${{ env.PR_TITLE }}" \
7375
--body "${{ env.PR_BODY }}" \
7476
--label "${{ env.PR_LABEL }}" \

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
### [1.0.1-rc.4](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.3...v1.0.1-rc.4) (2023-02-12)
6+
7+
8+
### Bug Fixes
9+
10+
* **github-actions:** fix fail steps and refactor code ([872d740](https://github.com/ansidev/sample-gitflow-release-workflows/commit/872d740b98dd15adc988079744656814229f37d5))
11+
512
### [1.0.1-rc.3](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.2...v1.0.1-rc.3) (2023-02-12)
613

714

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.1-rc.3
1+
1.0.1-rc.4

0 commit comments

Comments
 (0)