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

Improve release automation #72

Merged
merged 8 commits into from
Nov 2, 2024
Merged

Conversation

lkubb
Copy link
Member

@lkubb lkubb commented Oct 8, 2024

This commit introduces several helpers:

  • A script that reads the most recent released version from CHANGELOG.md and can be instructed to guess the next version based on news fragments.
  • A new workflow that renders the changelog and submits a PR with this changelog.
  • A new trigger for the release workflow that runs when pull requests are closed and checks if it was a release PR as created by the workflow described above.

In conclusion, this patch allows to quickly release new versions instead of having to perform the above steps manually on the CLI.

Fixes: #18

@lkubb lkubb force-pushed the release-pr-workflow branch 4 times, most recently from e97dc07 to 10e49dd Compare October 9, 2024 09:55
lkubb added 3 commits October 9, 2024 12:14
This commit introduces several helpers:

* A script that reads the most recent released version from CHANGELOG.md
  and can be instructed to guess the next version based on news
  fragments.
* A new workflow that renders the changelog and submits a PR with this
  changelog.
* A new trigger for the release workflow that runs when pull requests
  are closed and checks if it was a release PR as created by the
  workflow described above.

In conclusion, this patch allows to quickly release new versions instead
of having to perform the above steps manually on the CLI.
@lkubb lkubb force-pushed the release-pr-workflow branch from 10e49dd to 967aeb9 Compare October 9, 2024 10:15
.. also ensure there are no news fragments left when checking for
rendered changelog
@lkubb lkubb marked this pull request as ready for review October 9, 2024 12:01
@lkubb
Copy link
Member Author

lkubb commented Oct 9, 2024

@max-arnold Could you review this please? I like the simplicity of the new release process for maintainers, but could use another pair of eyes since the implementation is a bit tricky.

This optimizes for the usual case where releases are cut in a linear process from the default branch, brushing over many corner cases probably. I'm fine with this since extension projects should be kept simple. The manual release by tagging still works to account for more custom processes.

@max-arnold
Copy link
Contributor

Sorry for the delay. Will take a look early next week.

Copy link
Contributor

@max-arnold max-arnold left a comment

Choose a reason for hiding this comment

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

The resulting GH workflows are quite complex for me to review in a meaningful way (I have limited experience using them). I tried to run them locally using the act tool, but it turned out to be fiddly so I gave up.

Instead, below are a couple of questions to clarify:

  1. Am I correct that it will generate a release PR even if I just push my changes directly without making a feature PR?
  2. What will happen if I push two changes that contain changelog items? Will it result in two release PRs?
  3. Will the docs get rebuilt properly (i.e. contain the updated changelog) after I merge an automated release PR?
  4. For automated tagging, are there any benefits in using annotated tags?

@lkubb
Copy link
Member Author

lkubb commented Oct 16, 2024

The resulting GH workflows are quite complex for me to review in a meaningful way

No worries, I was primarily hoping for general comments/suggestions. :) Wasn't sure if there were obvious gotchas with this approach/workflow that I was missing.

  1. Am I correct that it will generate a release PR even if I just push my changes directly without making a feature PR?

Yes, but only if there is at least one news fragment to render.

  1. What will happen if I push two changes that contain changelog items? Will it result in two release PRs?

No, there will always be at most one open release PR (which is updated when new changes are pushed).

  1. Will the docs get rebuilt properly (i.e. contain the updated changelog) after I merge an automated release PR?

The automated release PR only builds the changelog (which would have needed to be done manually before). Merging it triggers the same workflows as when pushing a new tag, i.e. the docs are regenerated and published as always. The only issue is the release date - if the automated PR was generated day(s) before merging it, the release date is off.

  1. For automated tagging, are there any benefits in using annotated tags?

I don't see any, do you have suggestions?

@max-arnold
Copy link
Contributor

I don't see any, do you have suggestions?

Annotated tags have explicit attributes that might be useful to tell who and when made them:

  • Tag author
  • Date
  • Message

Also they are (kind of) immutable.

But it is just a suggestion to consider.

@lkubb
Copy link
Member Author

lkubb commented Oct 18, 2024

@max-arnold Thanks a lot for the suggestion, TIL. I assumed all tags were treated as git objects and were thus "immutable".

I'll set create_annotated_tag: true in the tag action to make it work as intended.

@lkubb lkubb merged commit 9ac4b51 into salt-extensions:main Nov 2, 2024
8 checks passed
@lkubb lkubb deleted the release-pr-workflow branch November 2, 2024 22:41
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.

[Feature] Improve release tooling
2 participants