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 on github release creation #71

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

eugenetriguba
Copy link
Collaborator

@eugenetriguba eugenetriguba commented Nov 11, 2023

This adds a workflow to Github Actions for creating a PyPI release when a GitHub release is created. The motivation for this is so that I would be able to handle #70.

In GitHub, this would require the PYPI_TOKEN secret being setup in the repository settings under Settings > Secrets and Variables > New Repository Secret.

This secret can be created via PyPI API Tokens: https://pypi.org/help/#apitoken. In particular, once the token is created:

To use an API token:
Set your username to __token__
Set your password to the token value, including the pypi- prefix

Poetry uses a format of POETRY_PYPI_TOKEN_<pypi repo name> so POETRY_PYPI_TOKEN_PYPI is the PyPI token for the official PyPI repository: https://python-poetry.org/docs/repositories/#configuring-credentials. It seems it handles sending along the username of __token__ for you.

@Zeitsperre
Copy link
Contributor

@eugenetriguba

Have you considered trying out the Trusted Publisher approach to this? I've been adopting this in a bunch of the projects I maintain, and I find it to be a nicer alternative than managing API Tokens.

e.g. https://github.com/Ouranosinc/xclim/blob/master/.github/workflows/publish-pypi.yml

@eugenetriguba
Copy link
Collaborator Author

@Zeitsperre Oh that is neat, I hadn't seen that before. Appreciate the mention, I'll give it a look 👍

@eugenetriguba eugenetriguba merged commit 2721c52 into master Nov 22, 2023
6 checks passed
@eugenetriguba eugenetriguba deleted the feature/add-release-workflow branch November 22, 2023 19:26
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.

None yet

3 participants