Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.

Commit ce1cb08

Browse files
ci: use trusted publishing
1 parent 0abfc0a commit ce1cb08

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed
Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
1-
# This workflows 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
3-
4-
name: Upload Python Package
1+
# use PyPI trusted publishing, as described here:
2+
# https://blog.trailofbits.com/2023/05/23/trusted-publishing-a-new-benchmark-for-packaging-security/
3+
name: publish to pypi
54

65
on:
76
release:
8-
types: [created]
7+
types: [published]
98

10-
jobs:
11-
deploy:
9+
permissions:
10+
contents: write
1211

12+
jobs:
13+
pypi-publish:
1314
runs-on: ubuntu-latest
14-
15+
environment:
16+
name: release
17+
permissions:
18+
id-token: write
1519
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 --skip-existing dist/*
20+
- uses: actions/checkout@v2
21+
- uses: astral-sh/setup-uv@v5
22+
- name: install
23+
run: uv sync
24+
- name: build package
25+
run: uv run python -m build
26+
- name: upload package artifacts
27+
uses: actions/upload-artifact@v4
28+
with:
29+
path: dist/*
30+
- name: publish package
31+
uses: pypa/gh-action-pypi-publish@release/v1
32+
with:
33+
skip-existing: true
34+
verbose: true
35+
print-hash: true

0 commit comments

Comments
 (0)