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
26 changes: 24 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,24 @@ jobs:
runs-on: ubuntu-latest
permissions:
contents: write
outputs:
prerelease: ${{ steps.check-version.outputs.prerelease }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_PAT }}
ref: 'release'

- name: Check if pre-release
id: check-version
run: |
if echo "${{ inputs.version }}" | grep -qE '(a|b|rc|alpha|beta|dev)[0-9]*$'; then
echo "prerelease=true" >> "$GITHUB_OUTPUT"
else
echo "prerelease=false" >> "$GITHUB_OUTPUT"
fi

- name: Install uv
uses: astral-sh/setup-uv@v6
with:
Expand All @@ -31,9 +42,11 @@ jobs:
run: uv run towncrier build --draft --version ${{ inputs.version }} > release_notes.rst

- name: Build changelog
if: steps.check-version.outputs.prerelease == 'false'
run: uv run towncrier build --yes --version ${{ inputs.version }}

- name: Commit, tag, and push release branch
if: steps.check-version.outputs.prerelease == 'false'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
Expand All @@ -44,6 +57,14 @@ jobs:
git push origin release --force
git push origin ${{ inputs.version }}

- name: Tag pre-release
if: steps.check-version.outputs.prerelease == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag ${{ inputs.version }}
git push origin ${{ inputs.version }}

- name: Upload release notes
uses: actions/upload-artifact@v4
with:
Expand Down Expand Up @@ -105,7 +126,7 @@ jobs:
run: uv publish --token ${{ secrets.PYPI_TOKEN }}

github-release:
needs: publish
needs: [publish, prepare]
runs-on: ubuntu-latest
permissions:
contents: write
Expand All @@ -128,4 +149,5 @@ jobs:
tag: ${{ inputs.version }}
bodyFile: release_notes.rst
artifacts: dist/*
makeLatest: true
prerelease: ${{ needs.prepare.outputs.prerelease == 'true' }}
makeLatest: ${{ needs.prepare.outputs.prerelease == 'false' }}
Loading