Skip to content

Commit 8851a82

Browse files
committed
Verify that downloader has signed tag
1 parent 7520c71 commit 8851a82

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

installer-downloader/build.sh

+37
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ BUNDLE_ID="net.mullvad.$BUNDLE_NAME"
3737

3838
FILENAME="Install Mullvad VPN"
3939

40+
# When --upload is passed, git verify-tag looks for a signed tag with the prefix below.
41+
# The signed tag must be named $TAG_PREFIX/<version>.
42+
TAG_PREFIX="desktop/installer-downloader/"
43+
4044
rm -rf "$BUILD_DIR"
4145
mkdir -p "$BUILD_DIR"
4246

@@ -356,6 +360,36 @@ function upload {
356360
upload_sftp "$checksums_path" "$version" || return 1
357361
}
358362

363+
# Check if the current commit has a signed tag
364+
#
365+
# Arguments:
366+
# - version
367+
function verify_version_tag {
368+
local version=$1
369+
370+
local expect_tag="${TAG_PREFIX}${version}"
371+
log_info "Current commit must have tag: $expect_tag"
372+
373+
local tag
374+
set +e
375+
tag=$(git describe --exact-match --tags)
376+
local describe_exit=$?
377+
set -e
378+
379+
if [[ $describe_exit -ne 0 ]]; then
380+
log_error "'git describe' failed for the current commit (no tag?). Expected tag $expect_tag"
381+
exit 1
382+
fi
383+
384+
if [[ "$tag" != "$expect_tag" ]]; then
385+
log_error "Unexpected tag found for current commit. Expected $expect_tag. Found: $tag"
386+
exit 1
387+
fi
388+
389+
log_info "Verifying tag $tag..."
390+
git verify-tag "$tag"
391+
}
392+
359393
function main {
360394
if [[ "$SIGN" != "false" ]]; then
361395
assert_can_sign
@@ -382,6 +416,9 @@ function main {
382416
if [[ "$UPLOAD" == "true" ]]; then
383417
local version
384418
version=$(product_version)
419+
420+
verify_version_tag "$version"
421+
385422
(cd "$DIST_DIR" && upload "$version") || return 1
386423
fi
387424
}

0 commit comments

Comments
 (0)