2021-12-11 19:33:14 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
target="$1"
|
|
|
|
|
|
|
|
case "$target" in
|
|
|
|
"staging")
|
|
|
|
nix_package="schulischer-schabernack-staging"
|
|
|
|
directory="staging"
|
|
|
|
;;
|
|
|
|
"production")
|
2022-01-28 14:06:25 +01:00
|
|
|
if [ "$(git rev-parse --abbrev-ref HEAD)" != "master" ]; then
|
|
|
|
echo "Not on master, refusing to deploy to production."
|
|
|
|
exit 1
|
|
|
|
fi
|
2021-12-11 19:33:14 +01:00
|
|
|
nix_package="schulischer-schabernack"
|
|
|
|
directory="production"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid target ${SCHABERNACK_ENV}"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
nix build -o "result-${target}" -L ".#${nix_package}"
|
2022-01-22 22:11:03 +01:00
|
|
|
rsync -vacrzLP --delete --delay-updates "result-${target}/" "schabernack@yuzuru.sbruder.xyz:${directory}"
|