3.0.0 #12
Workflow file for this run
This file contains 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: Bump version and release | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
inputs: | |
version: | |
description: Version for publishing | |
required: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.13" | |
- name: Get version | |
id: version | |
uses: actions/github-script@v7 | |
with: | |
result-encoding: string | |
script: | | |
if (context.payload.inputs && context.payload.inputs.version) { | |
return context.payload.inputs.version | |
} | |
return context.ref.split('/').pop() | |
- name: Set up uv | |
run: curl -LsSf https://astral.sh/uv/install.sh | sh | |
- name: Install the project | |
run: uv sync --dev | |
- name: Bump version | |
env: | |
VERSION: ${{ steps.version.outputs.result }} | |
run: | | |
echo "Bumping version to ${VERSION}" | |
sed -i 's/^version = ".*"$/version = "'$VERSION'"/' pyproject.toml | |
uv pip install . | |
- name: Set up git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "github-actions" | |
- name: Commit changes | |
env: | |
VERSION: ${{ steps.version.outputs.result }} | |
run: | | |
git add pyproject.toml | |
git commit -m "Release ${VERSION}" | |
git push | |
- name: Publish to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
rm -rf dist/* || true | |
uv build --sdist --wheel | |
uv publish |