Skip to content

release

release #48

Workflow file for this run

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