feat(release): publish gitea release notes and enable production rollback
This commit is contained in:
45
.gitea/scripts/extract-release-notes.sh
Normal file
45
.gitea/scripts/extract-release-notes.sh
Normal file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
tag="${1:-}"
|
||||
|
||||
if [ -z "$tag" ]; then
|
||||
echo "Missing release tag argument (expected vX.Y.Z)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f CHANGELOG.md ]; then
|
||||
echo "CHANGELOG.md not found."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
version="${tag#v}"
|
||||
|
||||
awk -v version="$version" '
|
||||
BEGIN {
|
||||
in_section = 0
|
||||
started = 0
|
||||
}
|
||||
/^## / {
|
||||
if (in_section == 1) {
|
||||
exit
|
||||
}
|
||||
|
||||
if (index($0, version) > 0) {
|
||||
in_section = 1
|
||||
started = 1
|
||||
print $0
|
||||
next
|
||||
}
|
||||
}
|
||||
{
|
||||
if (in_section == 1) {
|
||||
print $0
|
||||
}
|
||||
}
|
||||
END {
|
||||
if (started == 0) {
|
||||
exit 2
|
||||
}
|
||||
}
|
||||
' CHANGELOG.md
|
||||
Reference in New Issue
Block a user