Skip to content

Commit 6453814

Browse files
authored
ci: add github actions for release process (#12)
1 parent d8debc6 commit 6453814

File tree

4 files changed

+101
-0
lines changed

4 files changed

+101
-0
lines changed

.github/release-drafter.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name-template: '$RESOLVED_VERSION'
2+
tag-template: '$RESOLVED_VERSION'
3+
categories:
4+
- title: '🚀 Features'
5+
labels:
6+
- 'feat'
7+
- 'feature'
8+
- 'doc'
9+
- 'enhancement'
10+
- 'test'
11+
- 'refactor'
12+
- title: '🐛 Bug Fixes'
13+
labels:
14+
- 'fix'
15+
- 'bug'
16+
- title: '🧰 Maintenance'
17+
labels:
18+
- 'chore'
19+
- 'ci'
20+
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
21+
change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
22+
template: |
23+
$CHANGES

.github/workflows/develop.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ on:
33
push:
44
branches:
55
- develop
6+
- main
67
pull_request:
78
jobs:
89
lint:
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: "Draft new release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'The version to release'
8+
required: true
9+
10+
jobs:
11+
draft-new-release:
12+
name: "Draft new release"
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Validate the version
18+
uses: actions-ecosystem/action-regex-match@v2
19+
with:
20+
text: ${{ github.event.inputs.version }}
21+
regex: '^v\d+(\.\d+){2}$'
22+
23+
- name: Create release branch
24+
run: git checkout -b release/${{ github.event.inputs.version }}
25+
26+
- name: Push new branch
27+
run: git push origin release/${{ github.event.inputs.version }}
28+
29+
- name: Create pull request
30+
uses: thomaseizinger/[email protected]
31+
env:
32+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33+
with:
34+
head: release/${{ github.event.inputs.version }}
35+
base: main
36+
title: Release version ${{ github.event.inputs.version }}
37+
reviewers: ${{ github.actor }}
+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "Publish new release"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
types:
8+
- closed
9+
10+
jobs:
11+
release:
12+
name: Publish new release
13+
runs-on: ubuntu-latest
14+
15+
if: github.event.pull_request.merged == true
16+
17+
steps:
18+
- name: Extract version from branch name
19+
if: startsWith(github.event.pull_request.head.ref, 'release/')
20+
run: |
21+
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
22+
VERSION=${BRANCH_NAME#release/}
23+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
24+
25+
- name: Validate the version
26+
uses: actions-ecosystem/action-regex-match@v2
27+
with:
28+
text: ${{ env.RELEASE_VERSION }}
29+
regex: '^v\d+(\.\d+){2}$'
30+
31+
- name: Create Release
32+
id: generate_changelog
33+
uses: release-drafter/release-drafter@v5
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
version: ${{ env.RELEASE_VERSION }}
38+
tag: ${{ env.RELEASE_VERSION }}
39+
name: Release ${{ env.RELEASE_VERSION }}
40+
publish: false

0 commit comments

Comments
 (0)