mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
build: Update release-patch to handle bugfixes (#3446)
Bugfixes are done on branches that don't have an unreleased section in the CHANGELOG which would cause the last line to be deleted and the change put at the bottom of the CHANGELOG. Now there is a test for the unreleased section which if it exists does the old behavior. If not the new message will be placed above the last version section. Fixes: #2533 Signed-off-by: Joshua Shanks <jjshanks@gmail.com> Co-authored-by: Stephan Renatus <stephan.renatus@gmail.com>
This commit is contained in:
@@ -46,7 +46,8 @@ update_makefile() {
|
||||
}
|
||||
|
||||
update_changelog() {
|
||||
cat >_CHANGELOG.md <<EOF
|
||||
if $(grep -q '## Unreleased' CHANGELOG.md) ; then
|
||||
cat >_CHANGELOG.md <<EOF
|
||||
$(awk '1;/## Unreleased/{exit}' CHANGELOG.md | sed '$d')
|
||||
|
||||
## $VERSION
|
||||
@@ -54,7 +55,18 @@ $(awk '1;/## Unreleased/{exit}' CHANGELOG.md | sed '$d')
|
||||
$(./build/changelog.py $LAST_VERSION HEAD)
|
||||
$(sed '1,/## Unreleased/d' CHANGELOG.md)
|
||||
EOF
|
||||
else
|
||||
cat >_CHANGELOG.md <<EOF
|
||||
$(awk '{if ($1 == "##") {exit;} else {print $0}}' CHANGELOG.md)
|
||||
|
||||
## $VERSION
|
||||
|
||||
$(./build/changelog.py $LAST_VERSION HEAD)
|
||||
|
||||
$(awk '/^##/{f=1}f' CHANGELOG.md)
|
||||
EOF
|
||||
fi
|
||||
|
||||
mv _CHANGELOG.md CHANGELOG.md
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user