From 2d132bf342e3c07477c42ea625df43ad12c562fa Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Fri, 24 Jun 2022 00:38:39 +0000 Subject: [PATCH] build-release-tarball: Verify full releases are tagged and pushed. This ensures that anything that looks like a full release will identify itself as such. It requires that the version have a tag at the current commit (though it doesn't need to be pushed yet), as well as the commits exist in `main` or a release branch in the remote. --- tools/build-release-tarball | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/build-release-tarball b/tools/build-release-tarball index c8e81085d3..4ff4887ddc 100755 --- a/tools/build-release-tarball +++ b/tools/build-release-tarball @@ -62,6 +62,19 @@ git checkout-index -f -a --prefix "$TMPDIR/$prefix/" # Add the Git version information file ./tools/cache-zulip-git-version +if [[ "$version" =~ ^[0-9]+\.[0-9]+$ ]]; then + generated_version=$(head -n1 zulip-git-version) + base_version=$(head -n2 zulip-git-version | tail -n1) + if [ "$generated_version" != "$version" ]; then + echo "Version $version looks like a release version, but is not tagged yet! Got $generated_version" + exit 1 + fi + if [ "$base_version" != "$version" ]; then + remote="$(git config zulip.zulipRemote)" || remote=upstream + echo "Commit for $version have not been pushed to remote $remote -- 'branched from' reports $base_version, not $version" + exit 1 + fi +fi mv zulip-git-version "$TMPDIR/$prefix/" cd "$TMPDIR/$prefix"