]> code.octet-stream.net Git - hashgood/blob - buildscripts/dist.sh
Build scripts
[hashgood] / buildscripts / dist.sh
1 #!/bin/bash
2 set -euxo pipefail
3 cd "$(git rev-parse --show-toplevel)"
4
5 APP=hashgood
6
7 PLATFORM=$1
8 TAG=$2
9 source buildscripts/init.sh "${PLATFORM}"
10
11 BASENAME="${APP}-${TAG}-${PLATFORM}"
12
13 case $PLATFORM in
14 windows-x86_64)
15 FILENAME="${BASENAME}.zip"
16 TARCMD="/c/Windows/System32/tar.exe -acf ${FILENAME} ${BASENAME}"
17 ;;
18 mac-x86_64|mac-arm64)
19 FILENAME="${BASENAME}.pkg"
20 TARCMD="pkgbuild --identifier net.octet-stream.${APP} --install-location /usr/local/bin/ --root ./${BASENAME} ${FILENAME}"
21 ;;
22 *)
23 FILENAME="${BASENAME}.tar.xz"
24 TARCMD="tar -Jcf ${FILENAME} ${BASENAME}"
25 ;;
26 esac
27
28
29 cargo build --target "${RUST_TARGET}" --release
30
31 if [[ ${CODESIGNCMD:-"unset"} != "unset" ]]; then
32 "${CODESIGNCMD}" "target/${RUST_TARGET}/release/${APP}"
33 fi
34
35 cd target
36 mkdir "${BASENAME}"
37 mv "${RUST_TARGET}/release/${APP}" "${BASENAME}"
38 ${TARCMD}
39
40 if [[ ${NOTARISECMD:-"unset"} != "unset" ]]; then
41 "${NOTARISECMD}" "target/${FILENAME}"
42 fi
43
44 echo "PLATFORM_ARTIFACT|target/${FILENAME}"