summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonathan <jonathan@mullvad.net>2022-05-05 11:06:44 +0200
committerJonathan <jonathan@mullvad.net>2022-05-10 10:12:18 +0200
commitbb74520118752d6abfb30c1f0e38b853edfa0614 (patch)
treedb6853a9017c4be01a660944c733f01147a34fd8
parentef98a03181fd73ac66dc3f44d0ce7750ac800e22 (diff)
downloadmullvadvpn-bb74520118752d6abfb30c1f0e38b853edfa0614.tar.xz
mullvadvpn-bb74520118752d6abfb30c1f0e38b853edfa0614.zip
Optionally append tag name to artifact in build.sh
Make build.sh add a tag name to the artifact (.deb, .rpm, etc) if there exists a tag for the current commit. Does not change PRODUCT_VERSION
-rwxr-xr-xbuild.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/build.sh b/build.sh
index 6b5eb89544..16905c8e6f 100755
--- a/build.sh
+++ b/build.sh
@@ -379,8 +379,17 @@ esac
popd
SEMVER_VERSION=$(echo "$PRODUCT_VERSION" | sed -Ee 's/($|-.*)/.0\1/g')
+# `git tag --points-at` defaults to point at HEAD
+current_head_commit_tag=$(git tag --points-at)
for semver_path in dist/*"$SEMVER_VERSION"*; do
- product_path=$(echo "$semver_path" | sed -Ee "s/$SEMVER_VERSION/$PRODUCT_VERSION/g")
+ # If there is a tag for this commit then we append that to the produced artifacts
+ # We don't want to change the actual PRODUCT_VERSION as metadata in the form of +<metadata> is ignored by electron builder etc
+ version_suffix=""
+ if [[ -n "$current_head_commit_tag" ]]; then
+ # Remove disallowed version characters from the tag
+ version_suffix="+${current_head_commit_tag//[^0-9a-z_-]/}"
+ fi
+ product_path=$(echo "$semver_path" | sed -Ee "s/$SEMVER_VERSION/$PRODUCT_VERSION$version_suffix/g")
log_info "Moving $semver_path -> $product_path"
mv "$semver_path" "$product_path"