Skip to content

Commit 6d0c51b

Browse files
authored
Merge branch 'release/1.1.0-rc.0' into develop (#25)
2 parents ae8109d + 89b7535 commit 6d0c51b

File tree

3 files changed

+35
-31
lines changed

3 files changed

+35
-31
lines changed

.github/workflows/draft_release_hotfix_pr.yaml

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ env:
1313

1414
jobs:
1515
create_draft_pr:
16-
name: Create a draft PR for release/hotfix
16+
name: Create draft PR
1717
runs-on: ubuntu-latest
1818
permissions:
1919
contents: write
2020
# only create draft pull requests on pushing to branches 'release/' or 'hotfix/'
21-
if: (startsWith(github.head_ref, 'release/') || startsWith(github.head_ref, 'hotfix/'))
21+
if: (startsWith(github.ref_name, 'release/') || startsWith(github.ref_name, 'hotfix/'))
2222

2323
steps:
2424
- name: Set GitHub token
@@ -28,23 +28,23 @@ jobs:
2828
- name: Checkout repository
2929
uses: actions/checkout@v3
3030
with:
31-
ref: ${{ github.head_ref }}
31+
ref: ${{ github.ref_name }}
3232
token: ${{ env.GH_TOKEN }}
3333
# needed by "gh pr create"
3434
fetch-depth: 0
3535

3636
- name: Set environment variables for publishing release
37-
if: startsWith(github.head_ref, 'release/')
37+
if: startsWith(github.ref_name, 'release/')
3838
run: |
39-
BRANCH_NAME="${{ github.head_ref }}"
39+
BRANCH_NAME="${{ github.ref_name }}"
4040
VERSION=${BRANCH_NAME#release/}
4141
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
4242
echo "RELEASE_TYPE=release" >> $GITHUB_ENV
4343
4444
- name: Set environment variables for publishing hotfix
45-
if: startsWith(github.head_ref, 'hotfix/')
45+
if: startsWith(github.ref_name, 'hotfix/')
4646
run: |
47-
BRANCH_NAME="${{ github.head_ref }}"
47+
BRANCH_NAME="${{ github.ref_name }}"
4848
VERSION=${BRANCH_NAME#hotfix/}
4949
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
5050
echo "RELEASE_TYPE=hotfix" >> $GITHUB_ENV
@@ -63,19 +63,23 @@ jobs:
6363
6464
- name: Create PR '${{ env.PR_TITLE }}'
6565
env:
66-
PR_LABELS: "automated-pr,${{ env.RELEASE_TYPE}}-pr"
66+
PR_BODY: |
67+
This PR was created to prepare for releasing ${{ env.TAG_PREFIX }}${{ env.RELEASE_VERSION }}.
68+
69+
Merging this PR will create the GitHub release ${{ env.TAG_PREFIX }}${{ env.RELEASE_VERSION }}.
6770
run: |
68-
LABELS=${{ env.PR_LABELS }}
69-
for LABEL in $(echo $LABELS | sed "s/,/ /g"); do gh label create $LABEL --force; done
71+
PR_LABELS="automated-pr,${RELEASE_TYPE}-pr"
72+
for LABEL in $(echo $PR_LABELS | sed "s/,/ /g"); do gh label create $LABEL --force; done
7073
[[ ${PRE_RELEASE:false} == "true" ]] && gh label create 'pre-release' --force
7174
72-
PR_BODY=$(git log ${{ env.BRANCH_MAIN }}..${{ github.head_ref }} --pretty=format:%s)
73-
74-
gh pr create \
75-
--draft \
76-
--base ${{ env.BRANCH_MAIN }} \
77-
--head ${{ github.head_ref }} \
78-
--title "${{ env.PR_TITLE }}" \
79-
--body "$PR_BODY" \
80-
--label "${{ env.PR_LABELS }}" \
81-
--fill
75+
PR_ID=$(gh pr list --state open --search "base:${{ env.BRANCH_MAIN }} head:${{ github.ref_name }}" | head -1 | cut -f1)
76+
[[ ! -z "$PR_ID" ]] && \
77+
gh pr create \
78+
--draft \
79+
--base "${{ env.BRANCH_MAIN }}" \
80+
--head "${{ github.ref_name }}" \
81+
--title "${{ env.PR_TITLE }}" \
82+
--body "${{ env.PR_BODY }}" \
83+
--label "${PR_LABELS}" \
84+
--fill \
85+
|| echo "PR was created. Ignored!"

CHANGELOG.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,67 +2,67 @@
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.2](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.2-rc.0...v1.0.2) (2023-02-13)
5+
## [1.1.0-rc.0](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.2...v1.1.0-rc.0) (2023-02-13)
6+
7+
### Features
8+
9+
* **workflow-draft-release-hotfix-pr:** add new workflow for auto creating draft pr on pushing release or hotfix branch ([c539237](https://github.com/ansidev/sample-gitflow-release-workflows/commit/c53923703db4aaa1289092fe76482f98a10e6bea))
610

11+
### Documentations
12+
13+
* **readme:** update README.md ([9175012](https://github.com/ansidev/sample-gitflow-release-workflows/commit/9175012bed48f47fc08e681983ad21f81e8e2f04))
14+
15+
### [1.0.2](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.2-rc.0...v1.0.2) (2023-02-13)
716

817
### Bug Fixes
918

1019
* **github-actions:** fix PR body ([4701d3a](https://github.com/ansidev/sample-gitflow-release-workflows/commit/4701d3a33ea1f9563662ac0ddeb47ceb972e66d6))
1120

1221
### [1.0.2-rc.0](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.7...v1.0.2-rc.0) (2023-02-13)
1322

14-
1523
### Features
1624

1725
* **workflow-release:** auto create merge commit for PR on merging ([bc07fe5](https://github.com/ansidev/sample-gitflow-release-workflows/commit/bc07fe522fc2dbc8ea4171be7404a8870f4dce38))
1826
* **workflow-release:** auto merge PR after creating ([85a272f](https://github.com/ansidev/sample-gitflow-release-workflows/commit/85a272f377da0589b55bbc9420d933237f41ff6e))
1927

20-
2128
### [1.0.1-rc.7](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.6...v1.0.1-rc.7) (2023-02-13)
2229

23-
2430
### Bug Fixes
2531

2632
* **github-actions:** fix failed command gh pr create ([c57d773](https://github.com/ansidev/sample-gitflow-release-workflows/commit/c57d773547c355bbff010a12d602f4abb0cb985d))
2733

2834
### [1.0.1-rc.6](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.5...v1.0.1-rc.6) (2023-02-13)
2935

30-
3136
### Bug Fixes
3237

3338
* **github-actions:** correct command flag value ([95af6a2](https://github.com/ansidev/sample-gitflow-release-workflows/commit/95af6a2f92adb1f3a6709c9225b3028aedbc5987))
3439

3540
### [1.0.1-rc.5](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.4...v1.0.1-rc.5) (2023-02-13)
3641

37-
3842
### Bug Fixes
3943

4044
* **github-actions:** revert wrong changes ([1e044df](https://github.com/ansidev/sample-gitflow-release-workflows/commit/1e044dfd9746afbe7263c484813a8a26920119bf))
4145

4246
### [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)
4347

44-
4548
### Bug Fixes
4649

4750
* **github-actions:** fix fail steps and refactor code ([872d740](https://github.com/ansidev/sample-gitflow-release-workflows/commit/872d740b98dd15adc988079744656814229f37d5))
4851

4952
### [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)
5053

51-
5254
### Bug Fixes
5355

5456
* **github-actions:** remove invalid command flag ([1794f4c](https://github.com/ansidev/sample-gitflow-release-workflows/commit/1794f4cc27e9053e6ddbbccd01d7d0895812d510))
5557

5658
### [1.0.1-rc.2](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.1...v1.0.1-rc.2) (2023-02-12)
5759

58-
5960
### Bug Fixes
6061

6162
* **github-actions:** add missing checkout step ([e20f63a](https://github.com/ansidev/sample-gitflow-release-workflows/commit/e20f63ababd316d413b9573c727c68717b3b480d))
6263

6364
### [1.0.1-rc.1](https://github.com/ansidev/sample-gitflow-release-workflows/compare/v1.0.1-rc.0...v1.0.1-rc.1) (2023-02-12)
6465

65-
6666
### Bug Fixes
6767

6868
* **github-actions:** correct syntax ([dcea1b6](https://github.com/ansidev/sample-gitflow-release-workflows/commit/dcea1b6fde978a05ca3ff8855af26600e7a9f226))

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.0.2
1+
1.1.0-rc.0

0 commit comments

Comments
 (0)