Skip to content

Update release workflow to use Trusted Publishing #10263

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

Merged
merged 1 commit into from
Mar 8, 2025

Conversation

cdce8p
Copy link
Member

@cdce8p cdce8p commented Mar 8, 2025

Closes #10256

@cdce8p cdce8p added Maintenance Discussion or action around maintaining pylint or the dev workflow backport maintenance/3.3.x labels Mar 8, 2025
@cdce8p cdce8p requested a review from Pierre-Sassoulas March 8, 2025 21:07
Copy link

codecov bot commented Mar 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.86%. Comparing base (8486055) to head (54b617a).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #10263   +/-   ##
=======================================
  Coverage   95.86%   95.86%           
=======================================
  Files         175      175           
  Lines       19068    19068           
=======================================
  Hits        18280    18280           
  Misses        788      788           
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pierre-Sassoulas Pierre-Sassoulas added this to the 3.3.5 milestone Mar 8, 2025
Copy link
Member

@Pierre-Sassoulas Pierre-Sassoulas left a comment

Choose a reason for hiding this comment

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

Can't see anything wrong with it, let's test with a 3.3.5a0 version (then 3.3.5). I prepared the milestone, and I'll create the release branch shortly.

@cdce8p
Copy link
Member Author

cdce8p commented Mar 8, 2025

Can't see anything wrong with it, let's test with a 3.3.5a0 version (then 3.3.5). I prepared the milestone, and I'll create the release branch shortly.

Sounds good to me. I'm working on the astroid PR at the moment.
Feel free to merge this one. If there are other improvements I've missed, we can always add them later as well.

@Pierre-Sassoulas Pierre-Sassoulas merged commit 42aa204 into pylint-dev:main Mar 8, 2025
37 of 38 checks passed
Copy link
Contributor

github-actions bot commented Mar 8, 2025

The backport to maintenance/3.3.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-maintenance/3.3.x maintenance/3.3.x
# Navigate to the new working tree
cd .worktrees/backport-maintenance/3.3.x
# Create a new branch
git switch --create backport-10263-to-maintenance/3.3.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 42aa204b3d27a712588c3800b017149c74947486
# Push it to GitHub
git push --set-upstream origin backport-10263-to-maintenance/3.3.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-maintenance/3.3.x

Then, create a pull request where the base branch is maintenance/3.3.x and the compare/head branch is backport-10263-to-maintenance/3.3.x.

environment:
name: PyPI
url: https://pypi.org/project/pylint/
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the combined check needed?
Isn't release always connected to a tag?

Suggested change
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
if: github.event_name == 'release'

Also, there's now a convenient value for the ref type in the context:

Suggested change
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
if: github.ref_type == 'tag'

Copy link
Member Author

Choose a reason for hiding this comment

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

Nice! Didn't know about github.ref_type.

Isn't release always connected to a tag?

Yes, it should be. Created #10267 to just use github.event_name == 'release' for the check.

name: release-assets
path: dist/
- name: Sign the dists with Sigstore and upload assets to Github release
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not skip the entire job?

Copy link
Member Author

@cdce8p cdce8p Mar 9, 2025

Choose a reason for hiding this comment

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

The job shouldn't even start in the first place.

  • The workflow is only triggered on release -> published
  • The upload jobs (to Github and PyPI) need Build which is only run for github.event_name == 'release'
    build:
    name: Build release assets
    runs-on: ubuntu-latest
    if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags')

I usually prefer to be a bit more explicit with these checks when it comes to releases, even if not really necessary.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I had a feeling this was overly verbose..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport maintenance/3.3.x Maintenance Discussion or action around maintaining pylint or the dev workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[maintenance] Migrate PyPI release automation to Trusted Publishing
3 participants