Release script: add release notes to the git notes
This is a first change to get rid of the release commit on release branch.
Doing so will 1/ allows for git workflow (git cherry-pick), 2/ allows to
use merge feature from git notes.
--
Change-Id: Id6a93f0dc70b9efe8ff705f1dd2a16489989f281
Reviewed-on: https://cr.bazel.build/7337
MOS_MIGRATED_REVID=139904935
diff --git a/scripts/release/common.sh b/scripts/release/common.sh
index 20925fe..e17cedc 100755
--- a/scripts/release/common.sh
+++ b/scripts/release/common.sh
@@ -49,6 +49,11 @@
git notes --ref=release show "$@" 2>/dev/null | xargs echo || true
}
+# Extract the release notes from the git notes
+function get_release_notes() {
+ git notes --ref=release-notes show "$@" 2>/dev/null || true
+}
+
# Returns the info from the branch of the release. It is the current branch
# but it errors out if the current branch is not a release branch. This
# method returns the tag of the release and the number of the current
diff --git a/scripts/release/release.sh b/scripts/release/release.sh
index b9a0f4b..2dbb35f 100755
--- a/scripts/release/release.sh
+++ b/scripts/release/release.sh
@@ -213,6 +213,8 @@
create_release_commit "${release_title}" "${release_name}" \
"${relnotes}" "${tmpfile}" "${baseline}" $@
release_name=$(set_release_name "${release_name}" "${rc}")
+ # Add the release notes
+ git notes --ref=release-notes add -f -m "${relnotes}"
git checkout ${origin_branch} &> /dev/null
echo "Created ${release_name} on branch ${branch_name}."
@@ -228,6 +230,7 @@
git push -f ${repo} +${branch}
git push -f ${repo} +refs/notes/release
git push -f ${repo} +refs/notes/release-candidate
+ git push -f ${repo} +refs/notes/release-notes
done
}
@@ -282,6 +285,7 @@
git push $i +refs/tags/${tag_name}
git push $i +refs/notes/release-candidate
git push $i +refs/notes/release
+ git push $i +refs/notes/release-notes
done
cleanup_branches ${tag_name}
fi
diff --git a/scripts/release/release_test.sh b/scripts/release/release_test.sh
index 3b1d870..8eb6cbc 100755
--- a/scripts/release/release_test.sh
+++ b/scripts/release/release_test.sh
@@ -212,6 +212,7 @@
'
assert_equals "${header}Test replacement" "$(cat ${TEST_log})"
+ assert_equals "Test replacement" "$(get_release_notes release-v1)"
assert_equals 1 "$(get_release_candidate release-v1)"
push v1
@@ -233,6 +234,7 @@
- Attribute error messages related to Android resources are easier
to understand now.'
assert_equals "${header}${RELNOTES}" "$(cat ${TEST_log})"
+ assert_equals "${RELNOTES}" "$(get_release_notes release-v1)"
assert_equals 2 "$(get_release_candidate release-v1)"
# Push the release
diff --git a/scripts/release/relnotes.sh b/scripts/release/relnotes.sh
index 221c9de..b749028 100755
--- a/scripts/release/relnotes.sh
+++ b/scripts/release/relnotes.sh
@@ -90,7 +90,7 @@
# Build release notes arrays from a list of commits ($@) and return the release
# note in an array of array.
-function get_release_notes() {
+function generate_release_notes() {
for i in "${RELNOTES_TYPES[@]}"; do
eval "RELNOTES_${i}=()"
done
@@ -123,7 +123,7 @@
local i
local commits=$(get_release_notes_commits $@)
local length="${#RELNOTES_TYPES[@]}"
- get_release_notes "$commits"
+ generate_release_notes "$commits"
for (( i=0; $i < $length; i=$i+1 )); do
local relnotes_title="${RELNOTES_DESC[$i]}"
local relnotes_type=${RELNOTES_TYPES[$i]}