From 3ec5182762d210959ef8cf8fd779332c21d22cad Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 13 Nov 2026 19:02:00 +0000 Subject: [PATCH] Tag workflow: push a release tag from Actions and start publish and docs on it Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01MFB6QLT4Ln1yoTKcuQndXh --- .github/workflows/tag.yml | 41 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/tag.yml diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 00000000..f80ef03d --- /dev/null +++ b/.github/workflows/tag.yml @@ -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"