Skip to content

patch: Sign semantic release commits/tags #303

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
Jun 9, 2025

Conversation

jmgate
Copy link
Collaborator

@jmgate jmgate commented Jun 9, 2025

Type: Task

Description

This PR adds commit and tag signing to changes made by python-semantic-release in CI.

Related Issues/PRs

Thought #255 and #295 would take care of this automatically, but they didn't.

Finally figured out how to do this when researching #260.

Motivation

Signing releases means we have a better security posture.

Implementation Details

  • Generate a SSH key pair locally.
  • Add the public key as a deploy key to your repository with write access.
  • Store both the public and private keys as environment secrets for the release environment.
  • Make the workflow changes shown in the diff such that python-semantic-release can use the keys for signing.

Testing

I modified the configuration to allow python-semantic-release to create a new release commit and tag on this branch and verified that both were signed.

Summary by Sourcery

Enable commit and tag signing for releases by configuring python-semantic-release in CI to use SSH signing keys.

New Features:

  • Add commit and tag signing to semantic-release

CI:

  • Configure GitHub Actions workflow to provide SSH keys and committer identity for signing

Copy link

sourcery-ai bot commented Jun 9, 2025

Reviewer's Guide

Injects SSH-based signing into the python-semantic-release CI step by supplying committer identity and signing keys via GitHub Actions inputs and repository secrets.

Sequence Diagram: Commit and Tag Signing by python-semantic-release

sequenceDiagram
    participant WF as GitHub Actions Workflow
    participant PSR as python-semantic-release Action
    participant GIT as Git Repository

    WF->>PSR: Trigger release with committer_email, committer_name, ssh_private_signing_key, ssh_public_signing_key, github_token
    activate PSR
    PSR->>PSR: Prepare release (e.g., version bump)
    PSR->>GIT: Create commit
    PSR->>PSR: Sign commit using ssh_private_signing_key
    PSR->>GIT: Create tag
    PSR->>PSR: Sign tag using ssh_private_signing_key
    PSR->>GIT: Push signed commit and tag
    deactivate PSR
Loading

File-Level Changes

Change Details Files
Configure python-semantic-release to sign commits and tags
  • Add git_committer_email input
  • Add git_committer_name input
  • Add ssh_private_signing_key input
  • Add ssh_public_signing_key input
.github/workflows/semantic-release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

codecov bot commented Jun 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.97%. Comparing base (5dcf1cc) to head (e7dcfc3).
Report is 4 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #303   +/-   ##
=======================================
  Coverage   93.97%   93.97%           
=======================================
  Files           2        2           
  Lines         166      166           
  Branches       37       37           
=======================================
  Hits          156      156           
  Misses          4        4           
  Partials        6        6           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @jmgate - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@jmgate jmgate merged commit 6805d83 into master Jun 9, 2025
14 checks passed
@jmgate jmgate deleted the sign-release-commits-and-tags branch June 9, 2025 14:41
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.

1 participant