Use PyPI action and trusted publishing to publish packages
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
Start with the release job in .github/workflows/main.yml and compare it with the documented pypa/gh-action-pypi-publish trusted-publishing setup. Review the listed PyPI and GitHub environment configuration, then verify the release tox environment is no longer used in CI. Done means the workflow builds and publishes through the action with attestations and creates the GitHub release.
Written by the indexing model from the issue text.
Description
Switch to pypa/gh-action-pypi-publish for the publish to PyPI job in the CI workflow, instead of invocation of twine upload (via tox), using trusted publishing.
This adds build artefact attestations in the upload to PyPI. Trusted publishing (with attestations) means I can know for certain that what I download from PyPI is the same artefact which was generated in GitHub CI, meaning that what I see in GitHub is the same as what is installed - handy for auditing (rather than having to manually review all of the installed files on each release).
See the Python packaging documentation, the PyPI documentation, and the official pypi-publish GitHub action documentation on trusted publishing.
In the release job of the CI workflow, you would add the environment and permissions (id-token: write), and replace the Install tox and Run steps with four steps (assuming you don't want to split the build into a separate step, with less permissions):
- install dependencies:
run: pip install build 'jaraco.develop >= 7.1 - build the package:
run: python -m build - the PyPI publish action:
uses: pypa/gh-action-pypi-publish@release/v1(noTWINE_PASSWORDenv needed) - create the GitHub release:
run: python -m jaraco.develop.create-github-releaseandenv: { GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} }
You'll need to configure an environment in PyPI and GitHub. You will be able to remove the PYPI_USERNAME project secret.
The release tox environment would not be used in CI anymore.
- Dominant language
- No language data
- Stars
- 152
- Forks
- 38
- Avg merge
- 6h 27m
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from jaraco/skeleton
-
Difficulty 1/5 Under an hour Newbie friendliness 91/100
-
Difficulty 3/5 1-2 days Newbie friendliness 67/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Similar issues
-
ci cloudflare-workers consistency d1 dependencies difficulty: easy documentation dx enhancement github-actions good first issue help wanted javascript maintenance priority: P3 tests
Difficulty 1/5 Under an hour Newbie friendliness 86/100
-
enhancement
Difficulty 2/5 Half a day Newbie friendliness 66/100
nyaomaru/changelog-bot#364 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
HyeokjaeChoi/vaultme#585 ·
Maintainers usually reply within 1 day
-
infra nível 2 · médio pronta
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
starkjr-ifpr/ifplay#31 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
corail-labs/labcraft#176 ·
Maintainers usually reply within 1 day