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