Skip to content
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

chore(scripts): add release autoversion to bump releases in docs #13063

Conversation

mafredri
Copy link
Member

@mafredri mafredri commented Apr 24, 2024

This PR adds a command to bump versions in docs/markdown.

This is still standalone and needs to be wired up.

For now, I'm planning on putting this in scripts/release.sh (checkout main -> autoversion (this command) -> commit -> submit PR).

It would be pretty neat to make it a GH actions that's triggered on release though, something for the future.

Part of #12465

Copy link
Member Author

mafredri commented Apr 24, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @mafredri and the rest of your teammates on Graphite Graphite

scripts/release/main.go Outdated Show resolved Hide resolved
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

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

A couple of ideas on how to make the source code shorter

scripts/release/main.go Outdated Show resolved Hide resolved
scripts/release/main_test.go Show resolved Hide resolved
scripts/release/main_test.go Outdated Show resolved Hide resolved
docs/install/kubernetes.md Show resolved Hide resolved

match = strings.Replace(match, "[version]", `(?P<version>[0-9]+\.[0-9]+\.[0-9]+)`, 1)
logger.Debug(ctx, "compiling match regexp", "match", match)
matchRe, err = regexp.Compile(match)
Copy link
Member

Choose a reason for hiding this comment

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

maybe move it above and just do MustCompile (shorter code)?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think a panic here could be jarring. Since we’re actually compiling the contents from the markdown file, there’s no way to do this ahead of time :/

@mafredri mafredri marked this pull request as ready for review April 24, 2024 16:52
@stirby
Copy link
Collaborator

stirby commented Apr 24, 2024

This is great. From what I understand, the usage is:

<!-- autoversion(mainline): "string to match [version]" -->

to update the right version flags on the release?

In the future we will likely revisit how we present the release calendar and other install docs. Having this as an easily insertable call would be awesome.

@mafredri
Copy link
Member Author

mafredri commented Apr 24, 2024

This is great. From what I understand, the usage is:

<!-- autoversion(mainline): "string to match [version]" -->

to update the right version flags on the release?

Yes, exactly right. It simply needs to appear on/before the line where you want autoversioning to happen, and only the first line that matches is updated. And the format can even be "string to [version] match" (matching string to 0.0.0 match and updating 0.0.0). I there need's to be a v you'd do "string to v[version] match", etc.

In the future we will likely revisit how we present the release calendar and other install docs. Having this as an easily insertable call would be awesome.

❤️ Great, this is what I had in mind when implementing it. It's better to have it close to where it's used vs. defined somewhere far away in a random program. 😄

Base automatically changed from mafredri/feat-add-promote-mainline-to-stable to main April 24, 2024 19:59
@mafredri mafredri force-pushed the mafredri/04-24-chore_scripts_add_release_autoversion_to_bump_releases_in_docs branch from 694ac30 to 1fdff41 Compare April 25, 2024 08:50
@mafredri mafredri merged commit 46dced9 into main Apr 25, 2024
26 checks passed
Copy link
Member Author

Merge activity

@mafredri mafredri deleted the mafredri/04-24-chore_scripts_add_release_autoversion_to_bump_releases_in_docs branch April 25, 2024 09:11
@github-actions github-actions bot locked and limited conversation to collaborators Apr 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants