Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automate PyPI Deployment with GitHub Actions #13

Open
ojadeyemi opened this issue Nov 25, 2024 · 0 comments
Open

Automate PyPI Deployment with GitHub Actions #13

ojadeyemi opened this issue Nov 25, 2024 · 0 comments

Comments

@ojadeyemi
Copy link
Collaborator

ojadeyemi commented Nov 25, 2024

Description

Incorporate a GitHub Actions workflow to automate PyPI deployments. This ensures seamless and error-free package publishing upon creating a new release.

Using OpenID Connect (OIDC). OIDC allows secure, credential-free publishing of packages from trusted third-party services like GitHub Actions. READ MORE HERE

Reference

Here's an example workflow of how I did it for the usports-basketball package.

Note: I used pip but poetry will do the same thing

Steps

  1. Add GitHub as a trusted publisher on PyPI by visiting PyPI Publishing Settings (you must be logged in).
  2. Create a GitHub Actions workflow to build and publish the package to PyPI.
  3. Use OIDC authentication in the workflow with id-token: write permissions.
  4. Make sure to trigger only when a new release is published and update version no in pyproject.toml.
on:
  release:
    types: [published]
[tool.poetry]
name = "mplbasketball"
version = "1.0.0" # update to match release tag. You cant upload the same version twice to pypi

Image 1 Image 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant