4747: " ${RELEASE_WATCH:= ${RELEASE_DEFAULT} } "
4848: " ${RELEASE_WATCH_INTERVAL:= 30} "
4949
50+ if [ " ${RELEASE_SIGN} " -gt 0 ]; then
51+ if command -v shasum > /dev/null 2>&1 ; then
52+ sha512_sum=(shasum -a 512 -t)
53+ elif command -v sha512sum > /dev/null 2>&1 ; then
54+ sha512_sum=(sha512sum -t)
55+ else
56+ echo " The signing step requires 'shasum' or 'sha512sum'."
57+ exit 1
58+ fi
59+ fi
60+
5061cd " ${SOURCE_TOP_DIR} "
5162
5263if [ " ${RELEASE_PULL} " -gt 0 ] || [ " ${RELEASE_PUSH_TAG} " -gt 0 ]; then
@@ -126,6 +137,13 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
126137 done
127138 fi
128139
140+ run_identity=$( gh api " repos/${repository} /actions/runs/${run_id} " \
141+ --jq ' [.path, .event, .head_branch, .head_sha, .status, .conclusion] | join(" ")' )
142+ if [ " ${run_identity} " != " .github/workflows/rc.yml push ${rc_tag} ${rc_hash} completed success" ]; then
143+ echo " Workflow run ${run_id} is not a successful RC run for ${rc_tag} at ${rc_hash} . Not signing."
144+ exit 1
145+ fi
146+
129147 mkdir -p " ${rc_id} "
130148
131149 echo " Downloading .tar.gz and .sha512 from GitHub Releases"
@@ -136,8 +154,29 @@ if [ "${RELEASE_SIGN}" -gt 0 ]; then
136154 --repo " ${repository} " \
137155 --skip-existing
138156
139- echo " Signing tar.gz"
140157 cd " ${rc_id} "
158+ echo " Verifying release files against RC workflow run ${run_id} "
159+ (
160+ verify_dir=" ${TMPDIR:-/ tmp} /iceberg-cpp-rc.${RANDOM} .${RANDOM} "
161+ (umask 077 && mkdir " ${verify_dir} " )
162+ trap ' rm -rf "${verify_dir}"' EXIT
163+ if ! gh run download " ${run_id} " --name archive --dir " ${verify_dir} " --repo " ${repository} " ; then
164+ echo " Could not download the RC workflow archive. Not signing."
165+ exit 1
166+ fi
167+
168+ workflow_checksum=" ${verify_dir} /${tar_gz} .sha512"
169+ archive_sha512=$( " ${sha512_sum[@]} " " ${tar_gz} " )
170+ release_checksum_sha512=$( " ${sha512_sum[@]} " < " ${tar_gz} .sha512" )
171+ workflow_checksum_sha512=$( " ${sha512_sum[@]} " < " ${workflow_checksum} " )
172+ if [ " ${archive_sha512} " != " $( < " ${workflow_checksum} " ) " ] ||
173+ [ " ${release_checksum_sha512} " != " ${workflow_checksum_sha512} " ]; then
174+ echo " The RC files in ${rc_id} do not match workflow run ${run_id} . Not signing."
175+ exit 1
176+ fi
177+ )
178+
179+ echo " Signing tar.gz"
141180 gpg --armor --output " ${tar_gz} .asc" --detach-sig " ${tar_gz} "
142181 echo " Add signature to GitHub release"
143182 gh release upload " ${rc_tag} " \
0 commit comments