Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tag

# Starts a release from the Actions page: pushes the version tag on a commit of
# main, then runs publish.yml (PyPI) and docs.yml (versioned docs and the PDF
# manual on the release) on that tag. A tag pushed with the workflow token
# does not start other workflows, so both runs are started here.

on:
workflow_dispatch:
inputs:
version:
description: Version to release, as vX.Y.Z.
required: true
type: string
sha:
description: Commit to tag. It must be on main.
required: true
type: string

permissions:
contents: write # push the tag
actions: write # start the release runs

jobs:
tag:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- env:
VERSION: ${{ inputs.version }}
SHA: ${{ inputs.sha }}
GH_TOKEN: ${{ github.token }}
run: |
[[ "$VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] || { echo "::error::version must look like v1.2.3"; exit 1; }
git merge-base --is-ancestor "$SHA" origin/main || { echo "::error::$SHA is not on main"; exit 1; }
git tag "$VERSION" "$SHA"
git push origin "refs/tags/$VERSION"
gh workflow run publish.yml --repo "$GITHUB_REPOSITORY" --ref "$VERSION"
gh workflow run docs.yml --repo "$GITHUB_REPOSITORY" --ref "$VERSION"
Loading