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

Add release workflow for PyPI publish automation #665

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

djcopley
Copy link
Contributor

Not sure if you're interested in this piece of automation, but this workflow will automatically build and publish a FuseSoC release to PyPI when you create a GitHub release.

I configured it to use OIDC for authentication and to run in the production environment. This means that you can set up special rules, such as mandatory review etc., before it can execute.

@olofk
Copy link
Owner

olofk commented Jan 22, 2024

This looks good. The current release process is pretty much undocumented, but I currently run

python setup.py sdist
twine upload dist/fusesoc-<version>.tar.gz

Is this doing the same thing more or less? Haven't use the build package before. And finally, I didn't get how authentication works. Currently I have a password in ~/.pypirc but I guess that's not used with this flow.

@djcopley
Copy link
Contributor Author

djcopley commented Jan 22, 2024

Is this doing the same thing more or less?

It's doing basically the same. It uploads a wheel in addition. Including the wheel is good though as it shortens the installation time.

And finally, I didn't get how authentication works.

There is a protocol called Open ID Connect (OIDC) that GitHub and PyPI support. To configure it you'll have to do a few things.

  1. First go to the GitHub settings for this project and create an environment. This step is optional, but I highly recommend it for security. This is where you can set up all the approval and security rules. You can name it anything, however, it has to match what the workflow says. I named it 'release'.
  2. Next go to your PyPI publishing settings and go to the bottom where it says "Add a new publisher". Fill in the repository info and save.

To use the workflow, just create a release in GitHub. If you set up approval rules, the actual publish to PyPI action won't happen until the required approvers approve the deployment.

Here is a github article on configuring OIDC:
https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-pypi

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

Successfully merging this pull request may close these issues.

2 participants