#!/usr/bin/env bash # exit when any command fails set -e KEYFILE=/Users/notplants/.ssh/id_rsa SERVICE=peach-dyndns-updater # deploy rsync -avzh --exclude target --exclude .idea --exclude .git -e "ssh -i $KEYFILE" . rust@167.99.136.83:/srv/peachcloud/automation/peach-workspace/$SERVICE/ rsync -avzh --exclude target --exclude .idea --exclude .git -e "ssh -i $KEYFILE" ~/computer/projects/peachcloud/peach-workspace/peach-lib/ rust@167.99.136.83:/srv/peachcloud/automation/peach-workspace/peach-lib/ echo "++ cross compiling on vps" BIN_PATH=$(ssh -i $KEYFILE rust@167.99.136.83 'cd /srv/peachcloud/automation/peach-workspace/peach-dyndns-updater; /home/rust/.cargo/bin/cargo clean -p peach-lib; /home/rust/.cargo/bin/cargo build --release --target=aarch64-unknown-linux-gnu') echo "++ copying ${BIN_PATH} to local" rm -f target/$SERVICE scp -i $KEYFILE rust@167.99.136.83:/srv/peachcloud/automation/peach-workspace/target/aarch64-unknown-linux-gnu/release/peach-dyndns-updater ../target/vps-bin-$SERVICE #echo "++ cross compiling" BINFILE="../target/vps-bin-$SERVICE" echo $BINFILE echo "++ build successful" echo "++ copying to pi" ssh -t -i $KEYFILE peach@peach.link 'mkdir -p /srv/dev/bins' scp -i $KEYFILE $BINFILE peach@peach.link:/srv/dev/bins/$SERVICE