Skip to content

Release

Release #39

Workflow file for this run

name: Release
on:
release:
types: [published]
permissions:
contents: write # Needed to upload artifacts to the release
id-token: write # Needed for OIDC PyPI publishing
jobs:
release:
name: Publish to PyPI
runs-on: ubuntu-latest
environment: publishing
steps:
- name: Checkout code
uses: actions/checkout@v4.0.0
- name: Set up Python
uses: actions/setup-python@v4.7.0
with:
python-version: "3.10"
- name: Upgrade pip
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pip install pip
pip --version
- name: Install Poetry
env:
PIP_CONSTRAINT: .github/workflows/constraints.txt
run: |
pipx install poetry
poetry --version
- name: Check version
run: |
version=$(poetry version | awk '{print $2}')
tag=$(echo "${{ github.ref }}" | awk '{split($0,p,"/"); print p[3]}')
if [ "v$version" != $tag ]; then echo "Release tag and package version do not match!"; exit 1; fi;
- name: Build
run: poetry build
- name: Upload wheel to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*.whl
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.8.10