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 using Twine when a release is created
2
-
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
1
+
# This workflow will upload a Python Package using trusted publishers
2
+
# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
3
3
4
4
name: Upload Python Package
5
5
@@ -9,23 +9,27 @@ on:
9
9
10
10
jobs:
11
11
deploy:
12
-
13
12
runs-on: ubuntu-latest
14
13
14
+
permissions:
15
+
id-token: write # This is important for OIDC
16
+
contents: read # Recommended for checkout
17
+
15
18
steps:
16
-
- uses: actions/checkout@v2
17
-
- name: Set up Python
18
-
uses: actions/setup-python@v2
19
-
with:
20
-
python-version: '3.x'
21
-
- name: Install dependencies
22
-
run: |
23
-
python -m pip install --upgrade pip
24
-
pip install setuptools wheel twine
25
-
- name: Build and publish
26
-
env:
27
-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
28
-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
29
-
run: |
30
-
python setup.py sdist bdist_wheel
31
-
twine upload dist/*
19
+
- uses: actions/checkout@v5
20
+
- name: Set up Python
21
+
uses: actions/setup-python@v6
22
+
with:
23
+
python-version: '3.x'
24
+
- name: Install pypa/build
25
+
run: |
26
+
python -m pip install build --user
27
+
- name: Build Package
28
+
run: python -m build
29
+
- name: Publish to Pypi
30
+
uses: pypa/gh-action-pypi-publish@release/v1
31
+
with:
32
+
# This action handles building and publishing automatically
33
+
# No need to manually run setup.py or twine
34
+
# No secrets needed here for PyPI username/password
35
+
# The action will use the OIDC token from the permissions block
0 commit comments