Skip to content

feat(ci): automate label-based release versioning with Release Drafter - #24

Open
imshubham22apr-gif wants to merge 1 commit into
gemaraproj:mainfrom
imshubham22apr-gif:feature/automate-release-versioning
Open

imshubham22apr-gif wants to merge 1 commit into
gemaraproj:mainfrom
imshubham22apr-gif:feature/automate-release-versioning

Conversation

@imshubham22apr-gif

@imshubham22apr-gif imshubham22apr-gif commented Nov 10, 2026 •

Copy link
Copy Markdown

Summary

Updates release automation to adopt the organization's standard reusable release workflow:
github-community-projects/ospo-reusable-workflows/.github/workflows/release.yaml@ee8277bd76ef808b3a6e0bdd1f5a46a520a12c5d # v2.3.1 (following the pattern established in gemaraproj/go-gemara), while retaining maintainer control over version bumping and preserving PyPI Trusted Publishing.

Release Flow

Merged PRs update Draft Release
      │
      ▼
Maintainer triggers "Prepare Release" workflow_dispatch
      │
      ▼
Automated release-preparation PR opened (updates pyproject.toml + uv.lock, tagged with `release` & `skip-changelog`)
      │
      ▼
Maintainer reviews & merges the PR into `main`
      │
      ▼
.github/workflows/release.yml executes on push to `main`:
   ├─ Step 1: `ospo-reusable-workflows/release.yaml` finalizes notes, pushes `vX.Y.Z` & `vX` tags, and publishes the GitHub release
   ├─ Step 2: Chained `publish-pypi` job builds and publishes package to PyPI via Trusted Publishing (`id-token: write`)
   └─ Step 3: `verify-published` verifies package availability on the PyPI index

Why this architecture?
In ospo-reusable-workflows, publish: true publishes the release via GitHub Actions secrets.GITHUB_TOKEN. GitHub suppresses downstream cascade events from GITHUB_TOKEN, so a separate on: release: types: [published] workflow would not trigger. Chaining the PyPI publish job directly to the reusable workflow call ensures immediate, reliable publication in a single workflow run without relying on suppressed events.

Changes

1. Reusable Workflow Integration (.github/workflows/release.yml)

  • Replaced custom release drafting with github-community-projects/ospo-reusable-workflows/.github/workflows/release.yaml@ee8277bd76ef808b3a6e0bdd1f5a46a520a12c5d # v2.3.1.
  • Configured with release-only-with-label: true and release-config-name: release-drafter.yml.
  • Pinned and scoped with concurrency control (group: release, cancel-in-progress: false).
  • Chained publish-pypi directly on needs: release when needs.release.outputs.full-tag != ''.

2. Standardized Release Drafter Config (.github/release-drafter.yml)

  • Harmonized version resolver labels to accept both Gemara standard labels (breaking, major, feature, enhancement, minor, fix, maintenance, patch) and namespaced variants (release:major, release:minor, release:patch).
  • Configured include-pre-releases: true so the repository's v0.1.0 pre-release is properly anchored as the previous release baseline.
  • Configured pre-exclusion skip-changelog to omit release-preparation PRs from notes and version calculation.
  • Added autolabeler configuration aligning with gemaraproj/go-gemara.

3. Maintainer Version Preparation (.github/workflows/prepare-release.yml & tools/validate_release_version.py)

  • Provides workflow_dispatch accepting version X.Y.Z.
  • Validates SemVer format, ensures it is newer than published releases, and guards against re-running against the version already declared in pyproject.toml.
  • Updates pyproject.toml and synchronizes uv.lock (uv lock --check).
  • Runs full test suite, linters, typechecks, and package build.
  • Opens or updates an idempotent PR (release-prep/v<version>) labeled with release and skip-changelog.

4. Tests & Documentation

  • Unit tests in tests/tools/test_release_version.py validate semver parsing, API helpers, and parse .github/release-drafter.yml directly to verify resolution across all label combinations.
  • Updated CONTRIBUTING.md documenting the reusable workflow, label semantics, maintainer runbook, and troubleshooting.

Verification

  • uv run poe test — 134 passed
  • uv run poe lint — clean
  • uv run ruff format --check . — clean
  • uv run poe typecheck — 0 issues in 17 source files
  • uv lock --check — synchronized
  • uv build — built sdist + wheel cleanly
  • uvx zizmor .github/workflows — 0 security findings across all workflows
  • Commit is signed-off (DCO compliant).

Resolves #23

/cc @jpower432

@imshubham22apr-gif

Copy link
Copy Markdown
Author

Hi @jpower432,

Ready for review! All local suites (pytest, poe lint, ruff format, poe typecheck, uv lock --check, uv build, and zizmor) and DCO commit checks have passed.

A quick note regarding repository configuration needed to support this flow:
Since GitHub labels cannot be created from a fork, maintainers will need to create the following labels in repository settings if they don't already exist:

  • release:major
  • release:minor
  • release:patch
  • skip-changelog

Also, when the prepare-release workflow runs using GITHUB_TOKEN to open the version bump PR, repo branch protection / Actions policies may require a maintainer to approve running CI on the bot-created PR.

Let me know if you’d like any adjustments to the label defaults or workflow configuration!

@imshubham22apr-gif
imshubham22apr-gif force-pushed the feature/automate-release-versioning branch 2 times, most recently from 73d5c32 to 99c3eea Compare November 11, 2026 07:38
Resolves gemaraproj#23)

Signed-off-by: imshubham22apr-gif <imshubham.22apr@gmail.com>
@imshubham22apr-gif
imshubham22apr-gif force-pushed the feature/automate-release-versioning branch from 99c3eea to f02e3eb Compare November 11, 2026 10:02
@jpower432
jpower432 requested a review from jmeridth November 11, 2026 14:18

This branch has not been deployed

No deployments
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.

Automate label-based Python release versioning with Release Drafter

1 participant