summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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"