Skip to content

Commit 3577b1e

Browse files
[PR #7359/7911f1e9 backport][3.8]  Set up secretless publishing to PyPI (#7360)
Co-authored-by: Sviatoslav Sydorenko <[email protected]>
1 parent 8d45f9c commit 3577b1e

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

.github/workflows/ci.yml .github/workflows/ci-cd.yml

+30-2
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,17 @@ jobs:
347347

348348
deploy:
349349
name: Deploy
350-
environment: release
351350
needs: [build-tarball, build-wheels]
352351
runs-on: ubuntu-latest
352+
353+
permissions:
354+
contents: write # IMPORTANT: mandatory for making GitHub Releases
355+
id-token: write # IMPORTANT: mandatory for trusted publishing & sigstore
356+
357+
environment:
358+
name: pypi
359+
url: https://pypi.org/p/aiohttp
360+
353361
steps:
354362
- name: Checkout
355363
uses: actions/[email protected]
@@ -376,7 +384,27 @@ jobs:
376384
name: aiohttp
377385
version_file: aiohttp/__init__.py
378386
github_token: ${{ secrets.GITHUB_TOKEN }}
379-
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
380387
dist_dir: dist
381388
fix_issue_regex: "`#(\\d+) <https://github.com/aio-libs/aiohttp/issues/\\1>`_"
382389
fix_issue_repl: "(#\\1)"
390+
391+
- name: >-
392+
Publish 🐍📦 to PyPI
393+
uses: pypa/gh-action-pypi-publish@release/v1
394+
395+
- name: Sign the dists with Sigstore
396+
uses: sigstore/[email protected]
397+
with:
398+
inputs: >-
399+
./dist/*.tar.gz
400+
./dist/*.whl
401+
402+
- name: Upload artifact signatures to GitHub Release
403+
# Confusingly, this action also supports updating releases, not
404+
# just creating them. This is what we want here, since we've manually
405+
# created the release above.
406+
uses: softprops/action-gh-release@v1
407+
with:
408+
# dist/ contains the built packages, which smoketest-artifacts/
409+
# contains the signatures and certificates.
410+
files: dist/**

0 commit comments

Comments
 (0)