Skip to content

Rewrite README for accuracy, bump version to 0.2.2 #15

Rewrite README for accuracy, bump version to 0.2.2

Rewrite README for accuracy, bump version to 0.2.2 #15

Workflow file for this run

name: Release to PyPI
on:
release:
types: [published]
push:
tags:
- v*.*.*
jobs:
build-and-publish:
runs-on: ubuntu-latest
environment: release
permissions:
contents: read # Required to check out code
id-token: write # Required for OIDC authentication to PyPI
steps:
- uses: actions/checkout@v5
- name: Determine target environment
id: target
run: |
if [ "${{ github.event_name }}" == "push" ]; then
echo "environment=TestPyPI" >> $GITHUB_OUTPUT
echo "repository=test.pypi.org" >> $GITHUB_OUTPUT
else
echo "environment=Production PyPI" >> $GITHUB_OUTPUT
echo "repository=pypi.org" >> $GITHUB_OUTPUT
fi
- name: Release Information
run: |
echo "=========================================="
echo "Release to: ${{ steps.target.outputs.environment }}"
echo "Repository: ${{ steps.target.outputs.repository }}"
echo "Version: ${GITHUB_REF#refs/tags/v}"
echo "Trigger: ${{ github.event_name }}"
echo "=========================================="
- name: Install Poetry
run: pipx install poetry
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.13'
- name: Verify versioning
run: |
[ "$(poetry version -s)" == "${GITHUB_REF#refs/tags/v}" ]
- name: Install dependencies
run: poetry install
- name: Run tests
run: poetry run pytest
- name: Build packages
run: poetry build
- name: Publish to Test PyPI
if: ${{ github.event_name == 'push' }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
- name: Publish to Production PyPI
if: ${{ github.event_name == 'release' }}
uses: pypa/gh-action-pypi-publish@release/v1