-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcross_release.bash
More file actions
executable file
·33 lines (24 loc) · 1.2 KB
/
cross_release.bash
File metadata and controls
executable file
·33 lines (24 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#! /bin/bash
set -e
SCRIPT_PATH="$(readlink -f "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname -- "${SCRIPT_PATH}")"
cd "${SCRIPT_DIR}"
mkdir -p ./cross
if [[ "$#" -ne "3" ]]; then
echo "Please provide 3 arguments in the form of: TARGET TARGET-SSH TARGET-SOURCE-LOCATION"
exit 1
fi
TARGET=$1
# set up your ssh for public key authentication if you don't want to have to type in passwords
TARGET_SSH=$2
TARGET_SOURCE_LOCATION=$3
echo "syncing environment from ${TARGET_SSH}"
rsync --archive --sparse --compress --fsync --delete --recursive --mkpath --quiet --checksum "${TARGET_SSH}:/${TARGET_SOURCE_LOCATION}/lib" "${SCRIPT_DIR}/cross"
echo "building"
# `cargo install cross` if cross is not avaliable (you also need to have docker avaliable)
cross build --target "${TARGET}" --release --no-default-features
echo "deploying"
cd "${SCRIPT_DIR}/target/${TARGET}"
# this ignores anything in */deps/* (all the stuff generated in there binaries but not actually useful for running)
find ./ -type f ! -path "*/deps/*" -executable -print0 \
| rsync --archive --sparse --compress --fsync --delete --recursive --mkpath --progress --checksum --files-from=- --from0 ./ "${TARGET_SSH}:/${TARGET_SOURCE_LOCATION}/target/deployed"