-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (46 loc) · 1.46 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Trigger this workflow manually while choosing a branch in order to make a release.
#
# The release tag is inferred by commitizen by looking at the history of commit messages.
# It will be a dev release if the branch name matches the regex `DEVRELEASE_PATTERN`.
#
# This is going to:
# - Create the release tag
# - Update the package metadata and changelog
#
# For updating the API docs, see the workflow `api-docs.yml`
# For publishing a package, see the workflow `pypi.yml`
#
name: Release
on:
workflow_dispatch:
inputs:
dry-run:
type: boolean
default: false
required: false
description: Dry run
env:
DEVRELEASE_PATTERN: ^(?!main$).+$ # Match any branch name except 'main'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get metadata
id: get-metadata
run: |
if ! [[ -z $(echo "${GITHUB_REF#refs/heads/}" | grep -xP '${{ env.DEVRELEASE_PATTERN }}') ]] ; then
echo "devrelease=${GITHUB_RUN_ID}" >> $GITHUB_OUTPUT
else
echo "changelog=true" >> $GITHUB_OUTPUT
fi
- name: Commitizen
uses: commitizen-tools/commitizen-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
dry_run: ${{ github.event.inputs.dry-run }}
changelog: ${{ steps.get-metadata.outputs.changelog }}
devrelease: ${{ steps.get-metadata.outputs.devrelease }}