Repository navigation
66 lines (61 loc) · 1.77 KB
/
Copy pathpublish.yml
File metadata and controls
66 lines (61 loc) · 1.77 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
55
56
57
58
59
60
61
62
63
64
65
66
# Publishes cleanedweb to PyPI with trusted publishing (no API token).
#
# Runs only when started by hand from the Actions tab, with "publish" typed in, and only while the
# repository variable PYPI_PUBLISH_ENABLED is "true".
#
# One-time setup on pypi.org (Account settings > Publishing > Add a new pending publisher):
# PyPI project name: cleanedweb
# Owner: cleanedweb Repository name: cleanedweb-python
# Workflow name: publish.yml Environment name: pypi
#
# Bump the version and its CHANGELOG entry on main before starting a run: PyPI refuses to
# replace a version it already has.
name: Publish to PyPI
on:
workflow_dispatch:
inputs:
confirm:
description: 'Type "publish" to publish to PyPI'
required: true
type: string
permissions:
contents: read
jobs:
build:
name: Test and build
if: ${{ vars.PYPI_PUBLISH_ENABLED == 'true' && inputs.confirm == 'publish' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: "3.13"
- name: Test
run: |
python -m pip install -e ".[dev]"
pytest -q
- name: Build
run: |
python -m pip install build twine
python -m build
twine check dist/*
- uses: actions/upload-artifact@v7
with:
name: dist
path: dist/
if-no-files-found: error
publish:
name: Publish
needs: build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/cleanedweb/
permissions:
id-token: write
steps:
- uses: actions/download-artifact@v8
with:
name: dist
path: dist/
- uses: pypa/gh-action-pypi-publish@release/v1