Repository navigation
54 lines (48 loc) · 1.8 KB
/
Copy pathpython-publish.yml
File metadata and controls
54 lines (48 loc) · 1.8 KB
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
# This workflow publishes to PyPI when a `v*` tag is pushed. The tag push
# IS the release: nothing else in this repo should run `poetry publish`,
# `twine upload`, or cut a GitHub release by hand. See CHANGELOG.md 0.10.0
# for the rationale (this project was previously triggering on
# `release: published`, which decoupled the release event from the tag and
# commit it was supposed to represent).
#
# Auth: this workflow uses a stored PyPI API token (secrets.PYPI_API_TOKEN),
# not PyPI trusted publishing (OIDC). Switching to trusted publishing would
# need the project registered for it on PyPI first, so that migration is
# left as a separate follow-up; this change only fixes the trigger and adds
# the pre-publish version guard.
#
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
push:
tags:
- 'v*'
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Check that the tag matches pyproject.toml's version
run: python3 scripts/check_version.py --tag "${GITHUB_REF_NAME}"
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python -
export PATH="$HOME/.local/bin:$PATH"
- name: Install dependencies with Poetry
run: poetry install --no-root
- name: Build package with Poetry
run: poetry build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}