Skip to content

Enable PyPI publish workflow on version tag push#361

Merged
alexlib merged 3 commits intomasterfrom
copilot/add-deploy-to-pypi-option
Mar 11, 2026
Merged

Enable PyPI publish workflow on version tag push#361
alexlib merged 3 commits intomasterfrom
copilot/add-deploy-to-pypi-option

Conversation

Copy link
Contributor

Copilot AI commented Mar 11, 2026

This change adds a direct release path for publishing to PyPI when a new version tag is generated and pushed. Previously, publishing only ran on GitHub Release publication.

  • What changed

    • Updated the PyPI workflow trigger in .github/workflows/build.yml from release.published to tag-based push events.
    • Added support for both common tag formats used during version bumps:
      • vX.Y.Z
      • X.Y.Z
  • Why this matters

    • Publishing can now start immediately from the version-tagging flow, without requiring a separate Release publication step.
  • Workflow trigger example

    on:
      push:
        tags:
          - "v[0-9]*.[0-9]*.[0-9]*"
          - "[0-9]*.[0-9]*.[0-9]*"

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 11, 2026 17:21
Co-authored-by: alexlib <747110+alexlib@users.noreply.github.com>
Co-authored-by: alexlib <747110+alexlib@users.noreply.github.com>
Copilot AI changed the title [WIP] Add option to deploy to PyPI for new releases Enable PyPI publish workflow on version tag push Mar 11, 2026
@alexlib alexlib marked this pull request as ready for review March 11, 2026 17:30
Copilot AI review requested due to automatic review settings March 11, 2026 17:30
@alexlib alexlib merged commit 2347f85 into master Mar 11, 2026
5 checks passed
@alexlib alexlib deleted the copilot/add-deploy-to-pypi-option branch March 11, 2026 17:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the PyPI publish workflow trigger so publishing can run directly from version tag pushes (instead of requiring a GitHub Release), aligning release automation with a tag-based versioning flow.

Changes:

  • Switched .github/workflows/build.yml trigger from release.published to push on version-like tags.
  • Added support for both vX.Y.Z and X.Y.Z tag formats.

Comment on lines +3 to +6
push:
tags:
- "v[0-9]*.[0-9]*.[0-9]*"
- "[0-9]*.[0-9]*.[0-9]*"
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The tag globs here are more permissive than the stated intent of only matching vX.Y.Z / X.Y.Z. In GitHub Actions globbing, [0-9]* means “a digit followed by anything”, so tags like v1.2.3-rc1, v1.2.3.4, or v1.2.3foo can still match and trigger a publish. Consider adding an early validation step (e.g., shell regex check against ^v?\d+\.\d+\.\d+$) to fail fast, or otherwise tightening the trigger so pre-release/suffixed tags don’t publish unintentionally.

Copilot uses AI. Check for mistakes.
Comment on lines +3 to +6
push:
tags:
- "v[0-9]*.[0-9]*.[0-9]*"
- "[0-9]*.[0-9]*.[0-9]*"
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

Switching this workflow to run on push tag events means the job (which uses secrets.PYPI_API_TOKEN) will execute based on whatever workflow definition exists in the tagged commit. If someone with tag-push rights can create/move a matching tag, they could potentially run a modified workflow that exfiltrates the token. Consider adding a protected GitHub Environment for publishing (with required reviewers) and pulling the PyPI token from environment secrets, or otherwise gating the publish step to reduce the blast radius of tag-triggered runs.

Copilot uses AI. Check for mistakes.
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.

3 participants