Skip to content

Create a program to handle release chores #2790

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

Open
rickeylev opened this issue Apr 19, 2025 · 3 comments
Open

Create a program to handle release chores #2790

rickeylev opened this issue Apr 19, 2025 · 3 comments
Labels
cleanup Tech debt, resolving it improves our own velocity Good first issue A good first issue for people looking to contribute type: process

Comments

@rickeylev
Copy link
Collaborator

There's a few tedious and mechanical steps for our release process around replacing
strings and updating docs. See RELEASING.md for all the steps.

It should be relatively easy to create a program that does the various string processing. The basic logic it needs to do is:

  • Update CHANGELOG.md
    • Replace the "Unreleased" title with [X.Y.Z] - YYYY-MM-DD
    • Replace 0.0.0 with X.Y.Z
    • Replace v0-0-0 with vX-Y-Z
    • Caveat: don't modify the "unreleased template" that is commented out.
  • Replace VERSION_NEXT_* markers
    • caveat: don't replace them in CONTRIBUTING.md, RELEASING.md, and .* dirs (.githhub etc)

Something more advanced could look at which VERSION_NEXT_{FEATURE,PATCH} markers exist to figure out the next semantic version, but that's just a nice to have.

Just being able to do tools/private/release.py 1.4.0 would be a big improvement over all the ad-hoc stuff we have to do today.

@rickeylev rickeylev added cleanup Tech debt, resolving it improves our own velocity Good first issue A good first issue for people looking to contribute type: process labels Apr 19, 2025
@XueSongTap
Copy link

Can I work on this ?

@rickeylev
Copy link
Collaborator Author

Yep, go for it!

@XueSongTap
Copy link

Proposed Script Design for Automating Release Preparation

To streamline the release steps described in [RELEASING.md](https://github.com/bazel-contrib/rules_python/blob/main/RELEASING.md), I’ve designed a Python script that automates the key parts of the manual process.

Key Features

  1. Updates CHANGELOG.md:

    • Replaces ## [Unreleased] with ## [X.Y.Z] - YYYY-MM-DD
    • Replaces 0.0.0 with the actual version (e.g., 0.42.0)
    • Replaces v0-0-0 with vX-Y-Z (e.g., v0-42-0)
    • Skips modifying the "unreleased template" block that is commented out
  2. Replaces VERSION_NEXT_* placeholders:

    • Replaces VERSION_NEXT_MAJOR, VERSION_NEXT_MINOR, VERSION_NEXT_PATCH with the actual version
    • Skips replacement in specific files like RELEASING.md and CONTRIBUTING.md as per the guidelines

Script Behavior

  • The version (e.g., 0.42.0) is passed via a CLI argument for flexibility
  • The script is intended to be run manually before creating the release commit
  • It's implemented in Python and performs file-safe, regex-based replacements

Example Usage

python prepare_release.py --version 0.42.0

Let me know if this approach looks good to you, or if you'd prefer this logic to be integrated into a Bazel target or GitHub Action.
I'm happy to iterate based on your feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Tech debt, resolving it improves our own velocity Good first issue A good first issue for people looking to contribute type: process
Projects
None yet
Development

No branches or pull requests

2 participants