Skip to content

Commit 3b346a7

Browse files
committed
pypi: Add trusted publishing
1 parent 304c775 commit 3b346a7

2 files changed

Lines changed: 39 additions & 19 deletions

File tree

.github/workflows/ci.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,24 @@ jobs:
4444
with:
4545
name: coverage-report-py${{ matrix.python-version }}
4646
path: htmlcov/
47+
48+
create_wheel_and_sdist:
49+
runs-on: ubuntu-latest
50+
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v7
54+
55+
- name: Install uv
56+
uses: astral-sh/setup-uv@v8.3.2
57+
with:
58+
python-version: '3.13'
59+
60+
- name: Build wheel and sdist
61+
run: uv build
62+
63+
- name: Upload wheel and sdist as artifact
64+
uses: actions/upload-artifact@v7
65+
with:
66+
name: Package-Distributions-construct-editor
67+
path: dist/
Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,30 @@
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-
41
name: Upload Python Package
52

63
on:
74
release:
85
types: [created]
96

107
jobs:
11-
deploy:
8+
create_wheel_and_sdist:
9+
name: create_wheel_and_sdist
10+
uses: ./.github/workflows/main.yml
1211

12+
deploy:
13+
needs: [ create_wheel_and_sdist ]
1314
runs-on: ubuntu-latest
15+
16+
environment: pypi
17+
permissions:
18+
id-token: write # IMPORTANT: this permission is mandatory for Trusted Publishing
1419

1520
steps:
16-
- uses: actions/checkout@v2
17-
- name: Set up Python
18-
uses: actions/setup-python@v2
21+
- uses: actions/checkout@v7
22+
23+
- name: Download artifacts
24+
uses: actions/download-artifact@v8
1925
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/*
26+
name: Package-Distributions-construct-editor
27+
path: ./dist
28+
29+
- name: Publish package distributions to PyPI
30+
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)