Skip to content

Automate label-based Python release versioning with Release Drafter #23

Open

Description

@jpower432

Problem / Motivation

PyPI publishing is already automated for pushed v* tags, but preparing a release still requires manually updating the package version and creating a matching tag. There is currently no Release Drafter configuration or workflow to calculate the next version from pull-request labels and maintain release notes.

Current State

  • pyproject.toml declares a static package version (0.1.0).
  • .github/workflows/release.yml runs on pushed v* tags and rejects tags that do not match the declared package version.
  • CONTRIBUTING.md documents manually setting the version and pushing a matching tag.
  • The existing pipeline builds, verifies, publishes through PyPI Trusted Publishing, and verifies the published package.

Proposed Solution

Use Release Drafter to maintain draft release notes and resolve the next semantic version from labels on merged pull requests. Connect that resolved version to release preparation so package metadata, the lockfile, the GitHub release, and its tag stay consistent without manual version editing. Maintainers should retain control over when a release is published.

Acceptance Criteria

  • Add Release Drafter configuration and a workflow that maintains a draft release from merged PRs on the default branch.
  • Define and document labels for major, minor, and patch releases; use the highest applicable bump across merged PRs and document the behavior for unlabeled PRs.
  • Automatically prepare the resolved package version in pyproject.toml and keep uv.lock consistent before building release artifacts.
  • Ensure the release tag and published Python package version match, using a Python-compatible version format.
  • Explicitly connect the release/tag creation mechanism to the publishing pipeline, accounting for GitHub token event-trigger restrictions so an automated release actually starts publishing.
  • Preserve the existing build/verification checks, tag/version mismatch guard, and PyPI Trusted Publishing flow.
  • Verify patch/minor/major resolution, mixed-label precedence, unlabeled PR behavior, version/lockfile consistency, and repeat runs without duplicate releases or publications.
  • Update CONTRIBUTING.md with the label policy and maintainer release process.

Related Files

  • .github/workflows/release.yml
  • .github/workflows/publish-testpypi.yml
  • pyproject.toml
  • uv.lock
  • CONTRIBUTING.md

Activity

  1. added a commit that references this issue on Nov 10, 2026
    3182b3c
  2. imshubham22apr-gif commented on Nov 10, 2026

    @imshubham22apr-gif

    Hi @jpower432,

    I've implemented the label-based release automation requested here and opened pull request #24.

    Highlights of the implementation:

    • Release Drafter: Configured .github/release-drafter.yml and workflow with release:major, release:minor, and release:patch labels. Unlabeled PRs default to patch, and skip-changelog PRs are excluded from notes and version resolution.
    • Maintainer Release Preparation: Added a workflow_dispatch workflow (.github/workflows/prepare-release.yml) and validation tool (tools/validate_release_version.py) to validate the target SemVer against the active draft tag, update pyproject.toml and uv.lock, run test/lint/typecheck suites, and open/update a predictable release-prep/v<version> PR.
    • PyPI Trusted Publishing: Switched .github/workflows/release.yml to trigger on release: types: [published]. Maintainers publish the draft in GitHub's UI, generating a human event that reliably triggers the publishing pipeline.
    • Verification & Docs: Added unit tests in tests/tools/test_release_version.py covering all label scenarios (all 134 tests passing), verified clean zizmor audits across workflows, and updated CONTRIBUTING.md.

    Please see PR #24 for the full diff and verification details.

  3. added a commit that references this issue on Nov 10, 2026
    73d5c32
  4. jpower432 commented on Nov 10, 2026

    @jpower432
    ContributorAuthor

    @imshubham22apr-gif Apologies, I missed a constraint in the Issue body. We typically use https://github.com/github-community-projects/ospo-reusable-workflows (@jmeridth -- probably worth is putting in the global contributing guide). I think we still need the Python specific logic here, but the label-based release drafter automation is handled through these central workflows.

  5. added 2 commits that reference this issue on Nov 11, 2026
    99c3eea
    f02e3eb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions