Add workflow for creating new releases

Whenever a release branch - that is a branch starting with `release/` -
is merged into master, we create a new GitHub release based on the
version number in the branch name.

Similarly to the preview release, we extract the relevant section of
the changelog and make it the release body.
This commit is contained in:
Thomas Eizinger 2021-03-24 15:11:48 +11:00
parent 5e81555b85
commit d8e2e7beeb
No known key found for this signature in database
GPG Key ID: 651AC83A6C6C8B96
2 changed files with 44 additions and 3 deletions

View File

@ -1,12 +1,12 @@
name: "Release swap and asb" name: "Build swap and asb release binaries"
on: on:
release: release:
types: [created] types: [created]
jobs: jobs:
release: build_binaries:
name: Release swap name: Build swap and asb binaries
strategy: strategy:
matrix: matrix:
include: include:

41
.github/workflows/create-release.yml vendored Normal file
View File

@ -0,0 +1,41 @@
name: "Create release"
on:
pull_request:
types:
- closed
jobs:
create_release:
name: Create from merged release branch
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract version from branch name
id: extract-version
shell: python
run: |
branch_name = "${{ github.event.pull_request.head.ref }}"
version = branch_name.split("/")[1]
print(f"::set-output name=version::{version}")
- name: Extract changelog section for release
id: changelog
uses: coditory/changelog-parser@v1
with:
version: ${{ steps.extract-version.outputs.version }}
- name: Create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.BOTTY_GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract-version.outputs.version }}
release_name: ${{ steps.extract-version.outputs.version }}
draft: false
prerelease: false
body: ${{ steps.changelog.outputs.description }}
commitish: ${{ github.event.pull_request.merge_commit_sha }}