-
Notifications
You must be signed in to change notification settings - Fork 350
41 lines (38 loc) · 1.27 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
name: release
# based off of https://github.com/astral-sh/ruff/blob/main/.github/workflows/release.yaml
on:
workflow_dispatch:
inputs:
tag:
description: "The version to tag (without the leading 'v'). If omitted, will initiate a dry run (no uploads)."
default: ""
type: string
branch:
description: "The branch from which to release."
type: string
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
validate-tag:
name: Validate tag
runs-on: ubuntu-latest
# If you don't set an input tag, it's a dry run (no uploads).
if: ${{ inputs.tag }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.branch }}
- name: Check tag consistency
run: |
# Switch to the commit we want to release
git checkout ${{ inputs.branch }}
version=$(grep "^version = " pyproject.toml | sed -e 's/version = "\(.*\)"/\1/g')
if [ "${{ inputs.tag }}" != "${version}" ]; then
echo "The input tag does not match the version from pyproject.toml:" >&2
echo "${{ inputs.tag }}" >&2
echo "${version}" >&2
exit 1
else
echo "Releasing ${version}"
fi