2023-02-15 23:41:46 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# build the Linux artifacts for amd64, arm, arm64
|
|
|
|
#
|
|
|
|
# runs one background job per desired architecture unless there are too few CPUs
|
|
|
|
#
|
|
|
|
#
|
|
|
|
|
2024-02-02 07:53:32 +01:00
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
set -o xtrace
|
2023-02-15 23:41:46 +01:00
|
|
|
|
2024-07-24 21:17:18 +02:00
|
|
|
resolveArch() {
|
|
|
|
case ${1} in
|
|
|
|
amd64) echo amd64
|
|
|
|
;;
|
|
|
|
arm|armv7*|arm/v7*|armhf*) echo armhf
|
|
|
|
;;
|
|
|
|
arm64|armv8*|arm/v8*) echo arm64
|
|
|
|
;;
|
|
|
|
*) echo ${1}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2023-02-15 23:41:46 +01:00
|
|
|
# if no architectures supplied then default list of three
|
|
|
|
if (( ${#} )); then
|
|
|
|
typeset -a JOBS=(${@})
|
|
|
|
else
|
|
|
|
typeset -a JOBS=(amd64 arm arm64)
|
|
|
|
fi
|
|
|
|
|
2024-02-02 07:53:32 +01:00
|
|
|
(
|
|
|
|
HOME=/tmp/builder
|
|
|
|
# Navigate to the "ui" directory and run npm commands
|
|
|
|
npm config set cache /mnt/.npm
|
|
|
|
cd ./ui/
|
|
|
|
mkdir -p $HOME
|
|
|
|
npm install
|
|
|
|
npm run build
|
|
|
|
)
|
|
|
|
|
2024-07-24 21:17:18 +02:00
|
|
|
for ARCH in "${JOBS[@]}"; do
|
|
|
|
goreleaser build \
|
|
|
|
--clean \
|
|
|
|
--snapshot \
|
|
|
|
--output ./dist/ \
|
|
|
|
--config "./.goreleaser-linux-$(resolveArch "${ARCH}").yml"
|
2023-02-15 23:41:46 +01:00
|
|
|
done
|
|
|
|
|