Prepare release #6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Prepare release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| bump: | |
| description: Version bump over the latest tag | |
| required: true | |
| type: choice | |
| options: [patch, minor, major] | |
| default: patch | |
| permissions: | |
| contents: read | |
| jobs: | |
| prepare-release: | |
| runs-on: ubuntu-latest | |
| environment: release-auth | |
| permissions: | |
| contents: write # the release commit and its tag go straight to main | |
| steps: | |
| # An expired or revoked PAT otherwise surfaces as checkout's "Input required and not supplied: token". | |
| - name: Check the release token is set | |
| env: | |
| RELEASE_PAT: ${{ secrets.RELEASE_PAT }} | |
| run: | | |
| if [ -z "$RELEASE_PAT" ]; then | |
| echo "::error::RELEASE_PAT is unset; add it to the release-auth environment" | |
| exit 1 | |
| fi | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 # The next version comes from the tags. | |
| # A tag pushed with the workflow token starts no workflow, so the publish run needs this PAT. | |
| token: ${{ secrets.RELEASE_PAT }} | |
| persist-credentials: true | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 | |
| with: | |
| enable-cache: false | |
| # The annotated tag needs a committer identity. | |
| - name: Configure git | |
| run: | | |
| git config user.name "${GITHUB_ACTOR}" | |
| git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" | |
| - name: Tag the release | |
| env: | |
| BUMP: ${{ inputs.bump }} | |
| GH_TOKEN: ${{ secrets.RELEASE_PAT }} | |
| run: uvx --with tox-uv tox run -e release -- --bump "$BUMP" |