Skip to content

Commit de9a416

Browse files
authored
Merge pull request #104 from kellyrowland/pypi-trusted-publish
change release from twine to pypi trusted publishing
2 parents adacb44 + 2162a46 commit de9a416

1 file changed

Lines changed: 28 additions & 11 deletions

File tree

.github/workflows/release.yaml

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ on:
2626

2727
jobs:
2828
build-release:
29-
runs-on: ubuntu-latest
29+
runs-on: ubuntu-24.04
3030
steps:
31-
- uses: actions/checkout@v6
32-
- uses: actions/setup-python@v6
31+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
32+
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
3333
with:
34-
python-version: "3.12"
34+
python-version: "3.14"
3535

3636
- name: install build requirements
3737
run: |
@@ -44,11 +44,28 @@ jobs:
4444
python -m build --sdist --wheel .
4545
ls -l dist
4646
47+
- name: upload dists
48+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
49+
with:
50+
name: ${{ github.event.repository.name }}-dist
51+
path: dist/
52+
53+
pypi-publish:
54+
runs-on: ubuntu-24.04
55+
if: startsWith(github.ref, 'refs/tags/')
56+
environment:
57+
name: release
58+
needs:
59+
- build-release
60+
permissions:
61+
id-token: write
62+
63+
steps:
64+
- name: Get release artifacts
65+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
66+
with:
67+
name: ${{ github.event.repository.name }}-dist
68+
path: dist/
69+
4770
- name: Publish to PyPI
48-
if: startsWith(github.ref, 'refs/tags/')
49-
env:
50-
TWINE_USERNAME: __token__
51-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
52-
run: |
53-
pip install twine
54-
twine upload --skip-existing dist/*
71+
uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # release/v1

0 commit comments

Comments
 (0)