@@ -37,6 +37,10 @@ BUNDLE_ID="net.mullvad.$BUNDLE_NAME"
37
37
38
38
FILENAME=" Install Mullvad VPN"
39
39
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
+
40
44
rm -rf " $BUILD_DIR "
41
45
mkdir -p " $BUILD_DIR "
42
46
@@ -356,6 +360,36 @@ function upload {
356
360
upload_sftp " $checksums_path " " $version " || return 1
357
361
}
358
362
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
+
359
393
function main {
360
394
if [[ " $SIGN " != " false" ]]; then
361
395
assert_can_sign
@@ -382,6 +416,9 @@ function main {
382
416
if [[ " $UPLOAD " == " true" ]]; then
383
417
local version
384
418
version=$( product_version)
419
+
420
+ verify_version_tag " $version "
421
+
385
422
(cd " $DIST_DIR " && upload " $version " ) || return 1
386
423
fi
387
424
}
0 commit comments