Skip to content

v1.1.2

v1.1.2 #6

Workflow file for this run

name: Publish to PyPI
on:
# Manual trigger for testing
workflow_dispatch:
inputs:
target:
description: 'Publish target'
required: true
default: 'testpypi'
type: choice
options:
- testpypi
- pypi
# Automatic trigger on release
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build hatch
- name: Build package
run: python -m build
- name: Upload artifacts
uses: actions/upload-artifact@v6
with:
name: python-package-distributions
path: dist/
publish-to-testpypi:
name: Publish to TestPyPI
needs: build
runs-on: ubuntu-latest
# Only run for manual dispatch with testpypi target
if: github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi'
environment:
name: testpypi
url: https://test.pypi.org/p/antipasta
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true
publish-to-pypi:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
# Run for releases or manual dispatch with pypi target
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi')
environment:
name: pypi
url: https://pypi.org/p/antipasta
permissions:
id-token: write # Required for trusted publishing
steps:
- name: Download artifacts
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
verify-installation:
name: Verify Installation
needs: [publish-to-pypi]
# Only run after successful PyPI publish
if: success()
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: '3.11'
- name: Download artifacts
uses: actions/download-artifact@v7
with:
name: python-package-distributions
path: dist/
- name: Wait for PyPI to update
run: sleep 30
- name: Install from PyPI
run: |
VERSION=$(ls dist/antipasta-*.whl | head -n 1 | sed -E 's|.*antipasta-([0-9]+\.[0-9]+\.[0-9]+)-.*|\1|')
echo "Verifying antipasta==$VERSION from PyPI"
pip install "antipasta==$VERSION"
python -c "import antipasta; print(f'Successfully installed antipasta {antipasta.__version__}')"