Skip to content

Switch to trusted publishing for package upload to PyPI in CI #1560

@EpicWink

Description

@EpicWink

Trusted publishing (with attestations means I have high confidence 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.

See the Python packaging documentation, the PyPI documentation, and the official pypi-publish GitHub action documentation on trusted publishing.

Implementation (click to expand)
  • Configure (or use an existing) GitHub environment and add to PyPI
  • Remove user and password arguments in the "Publish to PyPI" step of the pypi job of the deploy CI workflow
  • Add the environment definition to the same pypi job
  • Add id-token: write and contents: read permissions to the same pypi job
  • Optionally remove the PYPI_PASSWORD project secret

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions