Skip to content

release-to-pypi

release-to-pypi #3

Workflow file for this run

# -- WORKFLOW: Publish/release this package on PyPI
# SEE:
# * https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# * https://docs.github.com/en/actions/use-cases-and-examples/building-and-testing/building-and-testing-python#publishing-to-pypi
#
# * https://docs.github.com/en/actions/writing-workflows
# * https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs
# * https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows#release
#
# GITHUB ACTIONS:
# * https://github.com/actions/checkout
# * https://github.com/pypa/gh-action-pypi-publish
#
# RELATED:
# * https://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
# -- STATE: PREPARED_ONLY, NOT_RELEASED_YET
name: release-to-pypi
on:
release:
types: [published]
# MAYBE: if: github.event_name == "push" && startsWith(github.ref, "refs/tags/v")
permissions:
contents: read
jobs:
publish-package:
runs-on: ubuntu-latest
# MAYBE: if: github.event_name == "push" && startsWith(github.ref, "refs/tags/v")
environment:
name: pypi
url: https://pypi.org/p/parse-type
permissions:
id-token: write # REQUIRED-FOR: Trusted publishing.
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: "Install Python package dependencies (with: uv)"
run: |
python -m pip install -U uv
python -m uv pip install -U pip setuptools wheel build twine
- name: Build this package
run: python -m build
- name: Check this package (before upload)
run: twine check dist/*
- name: Upload this package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
verbose: true