Skip to content

Commit 5185da7

Browse files
Merge backport and release job + unify workflow file naming
1 parent d9c160a commit 5185da7

1 file changed

Lines changed: 13 additions & 17 deletions

File tree

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "Release new version"
1+
name: "Publish new release"
22

33
on:
44
pull_request:
@@ -11,37 +11,33 @@ jobs:
1111
release:
1212
name: Publish new release
1313
runs-on: ubuntu-latest
14-
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
14+
if: github.event.pull_request.merged == true # only merged pull requests must trigger this job
1515
steps:
16-
- name: Extract version from branch name
16+
- name: Extract version from branch name (for release branches)
17+
if: startsWith(github.event.pull_request.head.ref, 'release/')
1718
run: |
1819
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
1920
VERSION=${BRANCH_NAME#release/}
2021
22+
echo "::set-env name=RELEASE_VERSION::$VERSION"
23+
- name: Extract version from branch name (for hotfix branches)
24+
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
25+
run: |
26+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
27+
VERSION=${BRANCH_NAME#hotfix/}
28+
2129
echo "::set-env name=RELEASE_VERSION::$VERSION"
2230
- uses: actions/checkout@v2
2331
with:
2432
ref: master
2533
- name: Create Release
2634
uses: actions/create-release@v1
2735
env:
28-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2937
with:
3038
tag_name: ${{ env.RELEASE_VERSION }}
3139
release_name: ${{ env.RELEASE_VERSION }}
32-
33-
backport:
34-
name: Backport release branch to dev branch
35-
runs-on: ubuntu-latest
36-
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
37-
steps:
38-
- name: Extract version from branch name
39-
run: |
40-
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
41-
VERSION=${BRANCH_NAME#release/}
42-
43-
echo "::set-env name=RELEASE_VERSION::$VERSION"
44-
- name: Create pull request for merging release branch into dev
40+
- name: Backport release to dev branch
4541
uses: thomaseizinger/create-pull-request@v1
4642
with:
4743
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)