Skip to content

Convert to trusted publishing - #62

Merged
diazona merged 1 commit into
masterfrom
trusted-publishing/1/dev
May 31, 2023
Merged

Convert to trusted publishing#62
diazona merged 1 commit into
masterfrom
trusted-publishing/1/dev

Conversation

@diazona

@diazona diazona commented May 21, 2023

Copy link
Copy Markdown
Contributor

I based this change on the official PyPI documentation as well as a blog post walking through an example of how to implement trusted publishing for a Python project.

The diff is fairly minimal. All it does is remove the password used to authenticate to PyPI, which we don't need anymore, and add a permission needed for trusted publishing to operate.

This commit will be accompanied by some configuration in the project settings on PyPI to allow this specific workflow to act as a trusted publisher. Specifically, I'm going to add a trusted publisher with the following settings:

  • Owner: pytest-dev
  • Repository name: pytest-localserver
  • Workflow name: release.yml
  • Environment name: pypi

and on Test PyPI I'm going to do the same except using test-pypi as the environment. I'll make those changes in a couple days, as long as no objections are raised before then, and then I'll try creating a test release and publishing it to Test PyPI (not regular PyPI) before merging this PR so I can make sure the flow works. After I've successfully published a release to both Test PyPI and regular PyPI - that will presumably be release 0.8 - I'll remove the secret tokens from both the pypi and test-pypi environments in this Github project.

Resolves #61

I based this change on the official PyPI documentation:
  https://docs.pypi.org/trusted-publishers/
as well as a blog post walking through an example of how to implement
trusted publishing for a Python project:
  https://pgjones.dev/blog/trusted-plublishing-2023/
The diff is fairly minimal. All it does is remove the password used to
authenticate to PyPI, which we don't need anymore, and add a permission
needed for trusted publishing to operate.

This commit will be accompanied by some configuration in the project
settings on PyPI to allow this specific workflow to act as a trusted
publisher. Effectively, we're telling PyPI that when this particular
workflow (`publish.yml`) contacts it with an OIDC token from Github,
then PyPI should accept that as valid authentication and return an API
token which can be used to actually upload a package.
@diazona diazona added this to the v0.8.0 milestone May 21, 2023
@diazona diazona self-assigned this May 21, 2023
@diazona
diazona requested review from coordt and redtoad May 21, 2023 04:38

@RonnyPfannschmidt RonnyPfannschmidt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to do this as soon as you like 👍

@diazona

diazona commented May 24, 2023

Copy link
Copy Markdown
Contributor Author

Whoops, forgot to do this yesterday, and I'm traveling for a few days... Since this is not urgent at all I'll finish it up when I get back

@diazona
diazona temporarily deployed to test-pypi May 31, 2023 08:06 — with GitHub Actions Inactive
@diazona

diazona commented May 31, 2023

Copy link
Copy Markdown
Contributor Author

I made the configuration changes in both pypi and test-pypi and confirmed that deployment of a dummy release to test-pypi works, so I'll merge this now. We should make sure to have at least one prerelease of the next final release (0.8, probably) in order to catch any problems with deploying to pypi before the final release goes live.

@diazona
diazona merged commit 02a6df1 into master May 31, 2023
@diazona
diazona deleted the trusted-publishing/1/dev branch May 31, 2023 08:46
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.

Change release action to use trusted publishing

2 participants