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
+
name: Upload Python Package
5
+
6
+
on:
7
+
release:
8
+
types: [published]
9
+
10
+
permissions:
11
+
contents: read
12
+
13
+
jobs:
14
+
release-build:
15
+
runs-on: ubuntu-latest
16
+
17
+
steps:
18
+
- uses: actions/checkout@v4
19
+
20
+
- uses: actions/setup-python@v5
21
+
with:
22
+
python-version: "3.x"
23
+
24
+
- name: Build release distributions
25
+
run: |
26
+
# NOTE: put your own distribution build steps here.
27
+
python -m pip install build
28
+
python -m build
29
+
30
+
- name: Upload distributions
31
+
uses: actions/upload-artifact@v4
32
+
with:
33
+
name: release-dists
34
+
path: dist/
35
+
36
+
pypi-publish:
37
+
runs-on: ubuntu-latest
38
+
needs:
39
+
- release-build
40
+
permissions:
41
+
# IMPORTANT: this permission is mandatory for trusted publishing
42
+
id-token: write
43
+
44
+
# Dedicated environments with protections for publishing are strongly recommended.
45
+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
46
+
environment:
47
+
name: pypi
48
+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
49
+
# url: https://pypi.org/p/YOURPROJECT
50
+
#
51
+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
52
+
# ALTERNATIVE: exactly, uncomment the following line instead:
0 commit comments