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

Push for PyPI Trusted Publisher usage #267

Merged
merged 1 commit into from
Jul 29, 2024

Conversation

CasperWA
Copy link
Collaborator

@CasperWA CasperWA commented Jul 12, 2024

Closes #180

Trusted Publisher is a feature from PyPI that is currently not supported from reusable/callable workflows.

To workaround this fact, the CD - Release workflow has been modified in two ways:

  1. The default for publish_on_pypi has been changed to false.
  2. A new step for uploading the built distribution files as a GitHub artifact has been added, with an input toggle upload_distribution that defaults to true.

To support the latter, a new build_dir input has been added, which specifies the build target folder for the distribution. It should match either the custom output folder expressed in the build_cmd input or the default build directory for the chosen build library.

In an attempt to combat users that rely on default values of publish_on_pypi, the input has been made a required input.
Hopefully, this has the effect that for workflows, where it has not been specified explicitly, any runs using the latest version will fail, prompting users to check the documentation, where an informational admonition has been placed front and center on the landing page, as well as at the top of the CD - Release-specific documentation page.

Note, the status of "required" for publish_on_pypi will only last for the next minor version release (expected to be v2.8).

The CD - Release-specific documentation page has had a new section added to it, regarding how one can utilize the workflow as well as implement PyPI's Trusted Publisher feature.


Example of the warning on the landing page that will be introduced by this PR:
image

Add new upload_distribution input to match a new step in the publish
distribution job, where the distribution folder is uploaded as an
artifact.
Add new build_dir input to specify the build target folder for the
distribution.

Make publish_on_pypi a required input, in the hope that this will catch
users that do not set the input and rely on its default, which has now
changed and would result in successful workflows that would however not
upload anything to PyPI as expected.
Remove the requirement of publish_on_pypi in the next next version.

Update the documentation, adding warnings about the default value change
to both the top of the specific workflow page, but also to the landing
page.
Add an example on how to still use the reusable/callable workflow and
also the new PyPI Trusted Publisher feature.
@CasperWA CasperWA requested a review from francescalb July 12, 2024 13:27
Copy link

codecov bot commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.61%. Comparing base (d20064e) to head (7cfffbb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #267   +/-   ##
=======================================
  Coverage   84.61%   84.61%           
=======================================
  Files          12       12           
  Lines         936      936           
=======================================
  Hits          792      792           
  Misses        144      144           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@Treesarj Treesarj left a comment

Choose a reason for hiding this comment

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

looks good

@CasperWA CasperWA merged commit 70bd787 into main Jul 29, 2024
25 checks passed
@CasperWA CasperWA deleted the cwa/close-180-support-pypi-trusted-publisher branch July 29, 2024 08:33
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.

Support new PyPI Trusted Publisher
3 participants