| 1 |
name: Pre-release |
| 2 |
on: |
| 3 |
workflow_dispatch: |
| 4 |
inputs: |
| 5 |
bump: |
| 6 |
description: "Version bump type" |
| 7 |
required: true |
| 8 |
type: choice |
| 9 |
options: |
| 10 |
- auto |
| 11 |
- major |
| 12 |
- minor |
| 13 |
- patch |
| 14 |
default: auto |
| 15 |
|
| 16 |
concurrency: |
| 17 |
group: pre-release-${{ github.ref }} |
| 18 |
cancel-in-progress: true |
| 19 |
|
| 20 |
permissions: {} |
| 21 |
|
| 22 |
jobs: |
| 23 |
pre-release: |
| 24 |
name: Pre-release |
| 25 |
runs-on: ubuntu-latest |
| 26 |
environment: release |
| 27 |
permissions: |
| 28 |
contents: write # to push release commit and tag |
| 29 |
steps: |
| 30 |
- name: Checkout code |
| 31 |
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 |
| 32 |
with: |
| 33 |
fetch-depth: 0 |
| 34 |
persist-credentials: false |
| 35 |
token: ${{ secrets.GH_RELEASE_TOKEN }} |
| 36 |
- name: Install the latest version of uv |
| 37 |
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 |
| 38 |
with: |
| 39 |
enable-cache: true |
| 40 |
cache-dependency-glob: "pyproject.toml" |
| 41 |
github-token: ${{ secrets.GITHUB_TOKEN }} |
| 42 |
- name: Set up Python |
| 43 |
run: uv python install 3.14 |
| 44 |
- name: Configure git identity from token owner |
| 45 |
env: |
| 46 |
GH_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} |
| 47 |
run: | |
| 48 |
user_info=$(gh api /user) |
| 49 |
git config user.name "$(echo "$user_info" | jq -r '.name // .login')" |
| 50 |
git config user.email "$(echo "$user_info" | jq -r '.id')+$(echo "$user_info" | jq -r '.login')@users.noreply.github.com" |
| 51 |
- name: Generate release commit and tag |
| 52 |
run: uv tool run --with tox-uv tox r -e release -- --version "$BUMP" --no-push |
| 53 |
env: |
| 54 |
BUMP: ${{ inputs.bump }} |
| 55 |
- name: Verify docs build against the release commit |
| 56 |
run: uv tool run --with tox-uv tox r -e docs |
| 57 |
- name: Push release commit and tag |
| 58 |
run: | |
| 59 |
git remote set-url origin "https://x-access-token:${GH_RELEASE_TOKEN}@github.com/$GITHUB_REPOSITORY.git" |
| 60 |
git push origin HEAD:main |
| 61 |
git push origin "$(git describe --tags --abbrev=0)" |
| 62 |
env: |
| 63 |
GH_RELEASE_TOKEN: ${{ secrets.GH_RELEASE_TOKEN }} |
| 64 |
GITHUB_REPOSITORY: ${{ github.repository }} |