Skip to content

Publish Python package with official action #8732

@EpicWink

Description

@EpicWink

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

Actions (click to expand)
  • Configure (or use an existing) GitHub environment and add to PyPI
  • In the Publish PyPi job of the Release CI workflow:
    • add aforementioned environment (eg name pypi), and permissions:
      + environment:
      +   name: pypi
      +   url: https://pypi.org/p/flatbuffers
      + permissions:
      +   id-token: write
      +   contents: read
    • in the Upload to PyPi step, switch to using the action:
      - run: python3 -m twine upload dist/*
      + uses: pypa/gh-action-pypi-publish@release/v1`
    • in the Install Dependencies step, remove twine:
      - python3 -m pip install setuptools wheel twine
      + python3 -m pip install setuptools wheel
  • You will be able to remove the TWINE_TOKEN project secret

Related: #8731

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions