Build Release #13
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: Build Release | |
on: | |
workflow_dispatch: | |
inputs: | |
version: | |
description: "Release version (e.g., 25.6.0). Do not include a leading 'v' or unnecessary zero padding." | |
required: true | |
branch: | |
description: "Branch to build from" | |
required: false | |
default: "main" | |
prerelease: | |
description: "Is this a pre-release (e.g. rc1, beta)?" | |
type: boolean | |
required: false | |
default: false | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- "3.12" | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v5 | |
with: | |
fetch-depth: 0 | |
ref: ${{ inputs.branch }} | |
- name: Install dependencies | |
run: pip install towncrier uv | |
- name: Generate final release notes with Towncrier | |
run: | | |
if [[ "${{ inputs.prerelease }}" == "false" ]]; then | |
towncrier build --version "${{ inputs.version }}" --yes | |
fi | |
- name: Update pyproject.toml and uv.lock with new version | |
run: uv version ${{ inputs.version}} | |
- name: Commit updated changelog | |
run: | | |
set -e | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add pyproject.toml uv.lock | |
git add docs/readthedocs/source/project_details/changelog.rst | |
git commit -m "Update version to ${{ inputs.version }} and generate release notes." | |
git push origin ${{ inputs.branch }} | |
- name: Create tag | |
run: | | |
git tag -a "${{ inputs.version }}" -m "Release ${{ inputs.version }}." | |
git push origin "${{ inputs.version }}" | |
- name: Create GitHub release and upload artifacts | |
uses: softprops/action-gh-release@v2 | |
with: | |
tag_name: "${{ inputs.version }}" | |
name: "${{ inputs.version }}" | |
draft: true # Set to true to create a draft release. | |
prerelease: ${{ inputs.prerelease == 'true' }} | |
body: | | |
See https://goats.readthedocs.io/en/v${{ inputs.version }}/project_details/changelog.html | |
generate_release_notes: true |