43 lines
1.6 KiB
Bash
43 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
# 빌드머신(ChanpacaLaptop=linux-x64 / Mac mini=osx-arm64)에서
|
|
# git HEAD 소스를 전송해 Cli + Avalonia 셸을 RID별 self-contained publish 하고
|
|
# 산출물을 로컬 out/remote/<rid>/ 로 수집한다.
|
|
#
|
|
# 사용 (Windows Git Bash): bash build/remote/build-remote.sh [linux|mac|all]
|
|
# 사전 조건: ssh 별칭 vd-linux / vd-mac (키 인증), 각 머신 ~/.dotnet SDK 8
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/../.."
|
|
|
|
TARGET="${1:-all}"
|
|
REMOTE_DIR="build/videodownloader"
|
|
|
|
push_src() { # $1 = ssh 대상
|
|
git archive HEAD | ssh -o BatchMode=yes "$1" "rm -rf $REMOTE_DIR && mkdir -p $REMOTE_DIR && tar -x -C $REMOTE_DIR"
|
|
}
|
|
|
|
build_on() { # $1 = ssh 대상, $2 = RID
|
|
echo "==> [$1] publish $2"
|
|
ssh -o BatchMode=yes "$1" "cd $REMOTE_DIR && export DOTNET_ROOT=\$HOME/.dotnet && export PATH=\$HOME/.dotnet:\$PATH && \
|
|
dotnet publish VideoDownloader.Cli -c Release -r $2 --self-contained -o out/cli-$2 && \
|
|
dotnet publish VideoDownloader.Avalonia -c Release -r $2 --self-contained -o out/avalonia-$2 && \
|
|
cd out && tar -czf artifacts-$2.tar.gz cli-$2 avalonia-$2"
|
|
}
|
|
|
|
collect() { # $1 = ssh 대상, $2 = RID
|
|
mkdir -p "out/remote/$2"
|
|
scp -o BatchMode=yes "$1:$REMOTE_DIR/out/artifacts-$2.tar.gz" "out/remote/$2/" && \
|
|
tar -xzf "out/remote/$2/artifacts-$2.tar.gz" -C "out/remote/$2" && \
|
|
echo " 수집: out/remote/$2/{cli-$2,avalonia-$2}"
|
|
}
|
|
|
|
if [[ "$TARGET" == "linux" || "$TARGET" == "all" ]]; then
|
|
push_src vd-linux
|
|
build_on vd-linux linux-x64
|
|
collect vd-linux linux-x64
|
|
fi
|
|
if [[ "$TARGET" == "mac" || "$TARGET" == "all" ]]; then
|
|
push_src vd-mac
|
|
build_on vd-mac osx-arm64
|
|
collect vd-mac osx-arm64
|
|
fi
|
|
echo "완료."
|