Skip to content

Commit

Permalink
ci: add github actions for release process (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkfsn authored May 19, 2021
1 parent d8debc6 commit 6453814
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name-template: '$RESOLVED_VERSION'
tag-template: '$RESOLVED_VERSION'
categories:
- title: '🚀 Features'
labels:
- 'feat'
- 'feature'
- 'doc'
- 'enhancement'
- 'test'
- 'refactor'
- title: '🐛 Bug Fixes'
labels:
- 'fix'
- 'bug'
- title: '🧰 Maintenance'
labels:
- 'chore'
- 'ci'
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
template: |
$CHANGES
1 change: 1 addition & 0 deletions .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- develop
- main
pull_request:
jobs:
lint:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/draft-new-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: "Draft new release"

on:
workflow_dispatch:
inputs:
version:
description: 'The version to release'
required: true

jobs:
draft-new-release:
name: "Draft new release"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Validate the version
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ github.event.inputs.version }}
regex: '^v\d+(\.\d+){2}$'

- name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}

- name: Push new branch
run: git push origin release/${{ github.event.inputs.version }}

- name: Create pull request
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/${{ github.event.inputs.version }}
base: main
title: Release version ${{ github.event.inputs.version }}
reviewers: ${{ github.actor }}
40 changes: 40 additions & 0 deletions .github/workflows/publish-new-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "Publish new release"

on:
pull_request:
branches:
- main
types:
- closed

jobs:
release:
name: Publish new release
runs-on: ubuntu-latest

if: github.event.pull_request.merged == true

steps:
- name: Extract version from branch name
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Validate the version
uses: actions-ecosystem/action-regex-match@v2
with:
text: ${{ env.RELEASE_VERSION }}
regex: '^v\d+(\.\d+){2}$'

- name: Create Release
id: generate_changelog
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
version: ${{ env.RELEASE_VERSION }}
tag: ${{ env.RELEASE_VERSION }}
name: Release ${{ env.RELEASE_VERSION }}
publish: false

0 comments on commit 6453814

Please sign in to comment.