Skip to content

Commit 794c3ba

Browse files
Create new release on PR merge
1 parent 80e2447 commit 794c3ba

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
11
name: "Release new version"
22

33
on:
4-
push:
4+
pull_request:
55
branches:
66
- master
7+
types:
8+
- closed
79

810
jobs:
911
release:
1012
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
1114
steps:
12-
- uses: actions/checkout@v2
13-
- name: Extract version from branch (what about hot fixes?)
14-
run: |
15-
echo "Hello world"
16-
- name: Make new release on GitHub
15+
- name: Extract version from branch name
1716
run: |
18-
echo "Hello world"
17+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
18+
VERSION=${BRANCH_NAME#release/}
19+
20+
echo "::set-env name=RELEASE_VERSION::$VERSION"
21+
- uses: actions/checkout@v2
22+
- name: Create Release
23+
uses: actions/create-release@v1
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
26+
with:
27+
tag_name: ${{ env.RELEASE_VERSION }}
28+
release_name: ${{ env.RELEASE_VERSION }}

0 commit comments

Comments
 (0)