You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# This workflow will upload a Python Package to PyPI when a release is created
2
+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3
+
4
+
# This workflow uses actions that are not certified by GitHub.
5
+
# They are provided by a third-party and are governed by
6
+
# separate terms of service, privacy policy, and support
7
+
# documentation.
8
+
9
+
name: Upload Python Package
10
+
11
+
on:
12
+
release:
13
+
types: [published]
14
+
15
+
permissions:
16
+
contents: read
17
+
18
+
jobs:
19
+
release-build:
20
+
runs-on: ubuntu-latest
21
+
22
+
steps:
23
+
- uses: actions/checkout@v4
24
+
25
+
- uses: actions/setup-python@v5
26
+
with:
27
+
python-version: "3.12"
28
+
29
+
- name: Build release distributions
30
+
run: |
31
+
python -m pip install --upgrade pip
32
+
pip install -r requirements.txt
33
+
pip install build twine
34
+
python -m build --sdist --wheel
35
+
36
+
- name: Verify distribution
37
+
run: |
38
+
twine check dist/*
39
+
40
+
- name: Upload distributions
41
+
uses: actions/upload-artifact@v4
42
+
with:
43
+
name: release-dists
44
+
path: dist/
45
+
46
+
pypi-publish:
47
+
runs-on: ubuntu-latest
48
+
needs:
49
+
- release-build
50
+
permissions:
51
+
# IMPORTANT: this permission is mandatory for trusted publishing
52
+
id-token: write
53
+
54
+
# Dedicated environments with protections for publishing are strongly recommended.
55
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
56
+
environment:
57
+
name: pypi
58
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
59
+
# url: https://pypi.org/p/YOURPROJECT
60
+
#
61
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
62
+
# ALTERNATIVE: exactly, uncomment the following line instead:
0 commit comments