1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
# =============================================================================
# GITHUB ACTIONS WORKFLOW: Publish/release this package on PyPI
# =============================================================================
# RELATED: Github actions -- Publishing a Python package
# * 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://github.com/actions/starter-workflows/blob/main/ci/python-publish.yml
#
# RELATED TO: pypi.org
# * https://docs.pypi.org/trusted-publishers/
# * https://docs.pypi.org/trusted-publishers/adding-a-publisher/
#
# RELATED: Github actions workflows
# * 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
# =============================================================================
# -- STATE: PREPARED_ONLY, NOT_RELEASED_YET
name: release-to-pypi
on:
release:
types: [published]
tags:
- v0.*
- v1.*
permissions:
contents: read
jobs:
publish-package:
runs-on: ubuntu-latest
if: ${{ 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@v5
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- 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 --strict dist/*
- name: Upload this package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
verbose: true
|