Skip to content

Release

Release #58

Workflow file for this run

name: Release
on:
pull_request:
push:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: poetry
cache-dependency-path: pyproject.toml
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Install dependencies
run: poetry install
- name: Build sdist
run: |
rm -rf dist # just in case
poetry run invoke build --sdist --wheel
- name: Check Tag # SemVer + PEP 440, e.g., 1.0.0rc1.post1
id: check-tag
run: |
if [[ ${{ github.ref }} =~ ^refs\/tags\/[0-9]+\.[0-9]+\.[0-9]+(a[0-9]+|b[0-9]+|rc[0-9]+)?(\.post[0-9]+)?(\.dev[0-9]+)?$ ]]; then
echo 'match=true' >>$GITHUB_OUTPUT
fi
- name: Publish to PyPI
if: steps.check-tag.outputs.match == 'true'
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish --no-interaction
- name: Publish to PyPI (dry-run)
if: steps.check-tag.outputs.match != 'true'
run: poetry publish --no-interaction --dry-run