Skip to content

Commit 1207a8b

Browse files
committed
Update GitHub Action for PyPI
1 parent 1fd5864 commit 1207a8b

1 file changed

Lines changed: 26 additions & 26 deletions

File tree

.github/workflows/publish-pypi.yml

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
name: Publish Python Package
1+
name: Publish Python distributions to PyPI
22

33
on:
44
release:
5+
types: [published]
56

67
jobs:
7-
build-and-publish:
8+
build-n-publish:
9+
name: Build and publish Python distributions to PyPI
810
runs-on: ubuntu-latest
11+
permissions:
12+
# Esta sección es crucial para la autenticación OIDC (Trusted Publishing)
13+
id-token: write
14+
contents: read
915

1016
steps:
11-
- name: Checkout repository
12-
uses: actions/checkout@v4
13-
14-
- name: Set up Python
15-
uses: actions/setup-python@v5
16-
with:
17-
python-version: "3.10"
18-
19-
- name: Install build tools
20-
run: |
21-
python -m pip install --upgrade pip
22-
pip install --upgrade build twine
23-
24-
- name: Build the package
25-
run: |
26-
python -m build
27-
28-
- name: Publish to PyPI
29-
env:
30-
TWINE_USERNAME: __token__
31-
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
32-
run: |
33-
twine upload dist/*
34-
17+
- uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v5
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install build dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install build
28+
29+
- name: Build binary wheel and source tarball
30+
run: python -m build
31+
32+
- name: Publish package distributions to PyPI
33+
uses: pypa/gh-action-pypi-publish@release/v1
34+
# Con OIDC configurado en PyPI, no necesitas secretos de API Token aquí
3535

0 commit comments

Comments
 (0)