-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auto create release on PR closure to deployment branch (#146)
One should add `Version: vX.Y.Z` to the title of the PR for creating a tag.
- Loading branch information
1 parent
eac4565
commit db27c86
Showing
3 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Create Release | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
|
||
jobs: | ||
create-release-tags: | ||
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'deployment' | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Extract version tag | ||
id: extract_version | ||
run: | | ||
output=$(python extract_tags.py "${{ github.event.pull_request.title }}") | ||
echo "::set-output name=tag::$output" | ||
- name: Create release | ||
id: create_release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
tag: ${{ steps.extract_version.outputs.tag }} | ||
name: Release v${{ steps.extract_version.outputs.tag }} | ||
bodyFile: ./release.md | ||
- name: Set outputs | ||
run: echo "release_id=${{ steps.create_release.outputs.id }}" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import sys | ||
import re | ||
|
||
def extract_version_from_title(title): | ||
match = re.search(r'(?<=Version: v)\d+\.\d+\.\d+', title) | ||
if match: | ||
return match.group() | ||
else: | ||
return None | ||
|
||
if __name__ == "__main__": | ||
title = sys.argv[1] | ||
version_tag = extract_version_from_title(title) | ||
if version_tag: | ||
print(version_tag) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
## Release description |