Skip to content

Add automated PyPI releases and CalVer release drafting workflows - #461

Open
Moustachauve wants to merge 1 commit into
dvd-dev:mainfrom
Moustachauve:ci/pypi-automatic-release
Open

Moustachauve wants to merge 1 commit into
dvd-dev:mainfrom
Moustachauve:ci/pypi-automatic-release

Conversation

@Moustachauve

@Moustachauve Moustachauve commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Automate PyPI package publishing and CalVer draft release generation.

Context & Rationale

Releases currently require manual packaging and distribution steps to publish to PyPI. In addition, Release Drafter did not automatically calculate upcoming release tags under python-hilo's calendar versioning scheme (YYYY.M.patch), requiring manual versioning coordination across pyproject.toml and pyhilo/const.py.

Following the release architecture established in python-hotspring and dvd-dev/hilo#1066, this PR introduces:

Required Setup Before Merging

Before this workflow can publish releases, the repository owner needs to configure PyPI Trusted Publishing and GitHub environments:

  1. PyPI Trusted Publishing:
    • Log in to pypi.org and open the python-hilo project settings (under Publishing).
    • Add a GitHub publisher with:
      • Owner: dvd-dev
      • Repository name: python-hilo
      • Workflow name: release.yaml
      • Environment name: release
  2. GitHub Environment:
    • In GitHub repository settings (Settings → Environments), create an environment named release (optional deployment protection rules or reviewers can be configured here).

New Release Workflow

After this PR is merged:

  1. Merge pull requests to main as normal. The Draft a release note workflow automatically updates a GitHub release draft with compiled release notes and the next CalVer tag (e.g., v2026.10.1).
  2. When ready to cut a release, navigate to Releases on GitHub, review the drafted notes, and click Publish release.
  3. Publishing the release automatically triggers .github/workflows/release.yaml, which sets the package version, builds the package, and publishes it directly to PyPI.

@Moustachauve
Moustachauve marked this pull request as ready for review October 8, 2026 03:42
Automated package publishing to PyPI was missing from python-hilo, requiring manual intervention for releases. In addition, Release Drafter previously lacked CalVer version calculation, which prevented automated tag and release note drafting under the YYYY.M.patch scheme used across the project history.

Following the release architecture established in python-hotspring and dvd-dev/hilo#1066:
- Introduces scripts/release.py to calculate the next CalVer version and stamp version changes across pyproject.toml and pyhilo/const.py, backed by unit tests in tests/test_release.py.
- Configures .github/workflows/release-drafter.yml to automatically calculate and apply the next CalVer version tag to GitHub release drafts on merge to main.
- Adds .github/workflows/release.yaml to build distribution packages and publish them to PyPI via Trusted Publishing (OIDC) when a GitHub release is published.

Maintainers must configure PyPI Trusted Publishing for the repository under the 'release' environment before the publishing workflow can upload packages.
@Moustachauve
Moustachauve force-pushed the ci/pypi-automatic-release branch from 2e1dd0a to 6a3f844 Compare October 8, 2026 03:42
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