Skip to content

Release v0.54.0

Release v0.54.0 #14

Workflow file for this run

# This workflow will upload a Python Package to PyPI when a release is created
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Set version from tag
run: |
# Extract tag name without 'v' prefix if present
VERSION=${GITHUB_REF#refs/tags/}
VERSION=${VERSION#v}
# Update version in setup.py, pyproject.toml or __init__.py
if [ -f "setup.py" ]; then
sed -i "s/version=['\"][^'\"]*['\"]/version='${VERSION}'/g" setup.py
fi
if [ -f "pyproject.toml" ]; then
sed -i "s/version = \"[^\"]*\"/version = \"${VERSION}\"/g" pyproject.toml
fi
if [ -f "__init__.py" ]; then
sed -i "s/__version__ = ['\"][^'\"]*['\"]/__version__ = '${VERSION}'/g" __init__.py
fi
- name: Build package
run: python -m build
- name: Check package
run: twine check dist/*
- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verify-metadata: true