Skip to content

Commit 3a7fa63

Browse files
committed
use official
1 parent a730a55 commit 3a7fa63

1 file changed

Lines changed: 55 additions & 5 deletions

File tree

.github/workflows/python-publish.yml

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,67 @@
66
# separate terms of service, privacy policy, and support
77
# documentation.
88

9-
name: Publish Package to PyPI
9+
name: Publish to PyPI
1010

1111
on:
1212
workflow_dispatch:
1313
release:
1414
types: [published]
1515

16+
permissions:
17+
contents: read
18+
1619
jobs:
17-
build:
20+
release-build:
1821
runs-on: ubuntu-latest
22+
1923
steps:
20-
- uses: actions/checkout@v3
21-
- name: Build and publish to pypi
22-
uses: JRubics/poetry-publish@v2.1
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-python@v5
27+
with:
28+
python-version: "3.x"
29+
30+
- name: Build release distributions
31+
run: |
32+
# NOTE: put your own distribution build steps here.
33+
python -m pip install build
34+
python -m build
35+
poetry build
36+
37+
- name: Upload distributions
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: release-dists
41+
path: dist/
42+
43+
pypi-publish:
44+
runs-on: ubuntu-latest
45+
needs:
46+
- release-build
47+
permissions:
48+
# IMPORTANT: this permission is mandatory for trusted publishing
49+
id-token: write
50+
51+
# Dedicated environments with protections for publishing are strongly recommended.
52+
# For more information, see: https://docs.github.com/en/actions/deployment/targeting-different-environments/using-environments-for-deployment#deployment-protection-rules
53+
environment:
54+
name: pypi
55+
# OPTIONAL: uncomment and update to include your PyPI project URL in the deployment status:
56+
# url: https://pypi.org/p/YOURPROJECT
57+
#
58+
# ALTERNATIVE: if your GitHub Release name is the PyPI project version string
59+
# ALTERNATIVE: exactly, uncomment the following line instead:
60+
# url: https://pypi.org/project/YOURPROJECT/${{ github.event.release.name }}
61+
62+
steps:
63+
- name: Retrieve release distributions
64+
uses: actions/download-artifact@v4
65+
with:
66+
name: release-dists
67+
path: dist/
68+
69+
- name: Publish release distributions to PyPI
70+
uses: pypa/gh-action-pypi-publish@release/v1
71+
with:
72+
packages-dir: dist/

0 commit comments

Comments
 (0)