The 2022 binaries link libpcre.so.3, which Debian 13 no longer ships. crystal now comes from the openSUSE repo of the node's Debian release and links with --static, so the result runs on any release; the build runs locally instead of cross-compiling through the build-agent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RywMtsL8qXG7GDY3MHq9Uh
32 lines
996 B
Bash
32 lines
996 B
Bash
#!/bin/bash
|
|
|
|
set -exu
|
|
|
|
DOWNLOAD_SERVER="${download_server}"
|
|
CONFIG=$(cat ${config_path})
|
|
JSON="$1"
|
|
ARGS="$2"
|
|
REPO_NAME=$(jq -r .repository.name <<< $JSON)
|
|
CLONE_URL=$(jq -r .repository.clone_url <<< $JSON)
|
|
BUILD_FILE=$(jq -r .file <<< $ARGS)
|
|
DATE=$(date --utc +%s)
|
|
SSH_OPTIONS='-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
|
|
|
|
cd ~
|
|
rm -rf "$REPO_NAME"
|
|
git clone "$CLONE_URL"
|
|
cd "$REPO_NAME"
|
|
shards install
|
|
|
|
for ARCH in $(jq -r '.architectures | keys[]' <<< $CONFIG)
|
|
do
|
|
TARGET=$(jq -r .architectures.$ARCH.target <<< $CONFIG)
|
|
BINARY="$REPO_NAME-$ARCH-$DATE"
|
|
|
|
# static, so the binary does not depend on the libraries of a debian release
|
|
crystal build "$BUILD_FILE" --static --release --target="$TARGET" -o "$BINARY"
|
|
|
|
ssh $SSH_OPTIONS "downloads@$DOWNLOAD_SERVER" mkdir -p "~/$REPO_NAME"
|
|
scp $SSH_OPTIONS "$BINARY" "downloads@$DOWNLOAD_SERVER:~/$REPO_NAME/$BINARY"
|
|
ssh $SSH_OPTIONS "downloads@$DOWNLOAD_SERVER" ln -sf "$BINARY" "~/$REPO_NAME/$REPO_NAME-$ARCH-latest"
|
|
done
|