X-Git-Url: https://code.octet-stream.net/hashgood/blobdiff_plain/fe58ffda1c19d5c4d5b7ff3b42e0de7a6b7136ff..585a245dd6e90efc545dbd68f928da9e03086cb9:/buildscripts/dist.sh?ds=sidebyside diff --git a/buildscripts/dist.sh b/buildscripts/dist.sh new file mode 100755 index 0000000..4ad4649 --- /dev/null +++ b/buildscripts/dist.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -euxo pipefail +cd "$(git rev-parse --show-toplevel)" + +APP=hashgood + +PLATFORM=$1 +TAG=$2 +source buildscripts/init.sh "${PLATFORM}" + +BASENAME="${APP}-${TAG}-${PLATFORM}" + +case $PLATFORM in +windows-x86_64) + FILENAME="${BASENAME}.zip" + TARCMD="/c/Windows/System32/tar.exe -acf ${FILENAME} ${BASENAME}" + ;; +mac-x86_64|mac-arm64) + FILENAME="${BASENAME}.pkg" + TARCMD="pkgbuild --identifier net.octet-stream.${APP} --install-location /usr/local/bin/ --root ./${BASENAME} ${FILENAME}" + ;; +*) + FILENAME="${BASENAME}.tar.xz" + TARCMD="tar -Jcf ${FILENAME} ${BASENAME}" + ;; +esac + + +cargo build --target "${RUST_TARGET}" --release + +if [[ ${CODESIGNCMD:-"unset"} != "unset" ]]; then + "${CODESIGNCMD}" "target/${RUST_TARGET}/release/${APP}" +fi + +cd target +mkdir "${BASENAME}" +mv "${RUST_TARGET}/release/${APP}" "${BASENAME}" +${TARCMD} + +if [[ ${NOTARISECMD:-"unset"} != "unset" ]]; then + "${NOTARISECMD}" "target/${FILENAME}" +fi + +echo "PLATFORM_ARTIFACT|target/${FILENAME}"