forked from selwin/python-user-agents
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (44 loc) · 1.21 KB
/
Copy pathpublish.yml
File metadata and controls
47 lines (44 loc) · 1.21 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
name: Publish to PyPI
# Publishes to PyPI whenever a GitHub Release is published.
# Uses PyPI Trusted Publishing (OIDC) - no API token is stored in the repo.
on:
release:
types: [published]
workflow_dispatch: # allow manual runs from the Actions tab
jobs:
build:
name: Build distributions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build sdist and wheel
run: |
python -m pip install --upgrade build
python -m build
- name: Check with twine
run: |
python -m pip install --upgrade twine
python -m twine check dist/*
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
needs: build
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write # required for trusted publishing (OIDC)
steps:
- uses: actions/download-artifact@v4
with:
name: dist
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true