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

CI: add automatic publication to pypi.org and test.pypi.org #13

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

hnez
Copy link
Member

@hnez hnez commented Apr 24, 2024

Publishing software manually is a (somewhat) error-prone and (somewhat) tedious process, hence why other projects have already automated this process.

Let's join these other projects and also automate our publication process!

The setup process is surprisingly straight forward and involves setting up trusted publishing on both pypi.org, as well as test.pypi.org. See linux-automation/lxa-iobus#46 for an example on how to do that.

The job also requires a Github Action variable to be set to run (to prevent it from running for forks - for which the publication step would fail due to insufficient permissions). Also see linux-automation/lxa-iobus#46 for an example on how to do that.

TODO before merging:

Both of these PRs should be merged before this one.

We want to reduce the potential for human error in our publication process
and also streamline the process for everyone with the permission to create
tags in the repository.

The CI job runs for new commits pushed to the master branch and newly
pushed tags, as long as the PUBLISH_PYPI GitHub Action variable is set
to "true".
This is to prevent CI runs on forked repository from failing because they
are not allowed to publish on pypi.org and test.pypi.org.
A fork that wants to use the publish logic just has to set the
PUBLISH_PYPI variable for their repository.

The job does not check out the git repository (hence why it does not use
the existing publication logic in the Makefile) and instead downloads
the artifacts generated by the build job.

All builds are uploaded to test.pypi.org (so they can be tested via pip
install) and tagged releases are uploaded to pypi.org as well.

Also remove the upload helpers from the Makefile to make it clear that
they are replaced by the automated process.

Signed-off-by: Leonard Göhrs <[email protected]>
@SmithChart SmithChart merged commit 7c8cd50 into linux-automation:master Apr 25, 2024
4 checks passed
@hnez hnez deleted the auto-pypi branch April 25, 2024 13:39
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