hashicorp / terraform-provider-kubernetes

Terraform Kubernetes provider
https://www.terraform.io/docs/providers/kubernetes/
Mozilla Public License 2.0
1.58k stars 967 forks source link

Simplify past tags detection in release workflow #2521

Closed alexsomesan closed 3 months ago

alexsomesan commented 3 months ago

This change replaced the command used by the release workflow to detect existing tags with a simpler version based on git tag rather then git describe.

Description

Acceptance tests

Output from acceptance testing:

N/A

Release Note

Release note for CHANGELOG:

N/A

References

Community Note

alexsomesan commented 3 months ago

If I run these steps:

  • git pull --tags
  • git checkout v2.31.0
  • sed -n -e "1{/# /d;}" -e "2{/^$/d;}" -e "/# $(git tag --list 'v*' --sort=-version:refname | head -n 2 | tail -n 1 | tr -d v)/q;p" CHANGELOG.md > release-notes.txt

I get the changelog entry as shown here: https://github.com/hashicorp/terraform-provider-kubernetes/releases/tag/v2.31.0 👍

This isn't a problem with this PR, but if I checkout an older tag the command doesn't work. The release note generation command (both withgit tag and git describe) assumes that it's only being run on the latest tag in the repo. Just figured I'd mention that as a pre-existing limitation of the command.

That's a great point to keep in mind, Sarah. Thanks for pointing it out. I guess it goes back to | head -n 2 | tail -n 1 which in itself assumes we're starting for the top-most tag. We could improve this further by detecting if the current HEAD has a specific tag and counting back from that one to the next oldest one.