67 lines
1.9 KiB
Bash
Executable File
67 lines
1.9 KiB
Bash
Executable File
#!/bin/sh
|
|
set -e
|
|
|
|
MIZE_SRC="/home/me/work/mize" # hardcoded for now
|
|
RSYNC_EXCLUDES="--exclude=node_modules --exclude=target --exclude=mize_config.toml --exclude=rust_dist --exclude=deno_dist --exclude=dist --exclude=result --exclude=pkg"
|
|
|
|
function main {
|
|
if [[ "$1" == "dlu" ]]; then
|
|
deploy_lush
|
|
fi
|
|
|
|
if [[ "$1" == "dma" ]]; then
|
|
deploy_main_website
|
|
fi
|
|
|
|
if [[ "$1" == "dmo" ]]; then
|
|
deploy_main_obsidian
|
|
fi
|
|
}
|
|
|
|
|
|
function deploy_lush {
|
|
echo "c2vi: Deploying to lush..."
|
|
|
|
# Copy files to lush
|
|
rsync -r -u -v -a --delete --include=".git/" --include=".git/**" --mkpath $RSYNC_EXCLUDES $MIZE_SRC lush:here
|
|
|
|
# compile
|
|
ssh lush << EOF
|
|
if ! tmux has-session -t ppc-deploy 2>/dev/null; then
|
|
echo "Created new tmux session...."
|
|
tmux new-session -d -s ppc-deploy "nix develop git+file:///home/me/here/mize#buildShell"
|
|
tmux send-keys -t ppc-deploy "cargo build --featuers desktop --manifest-path /home/me/here/mize/packages/ppc/Cargo.toml" Enter
|
|
tmux send-keys -t ppc-deploy "systemctl --user restart ppc" Enter
|
|
else
|
|
echo "using existing session..."
|
|
tmux send-keys -t ppc-deploy "cargo build --features desktop --manifest-path /home/me/here/mize/packages/ppc/Cargo.toml" Enter
|
|
tmux send-keys -t ppc-deploy "systemctl --user restart ppc" Enter
|
|
fi
|
|
EOF
|
|
|
|
}
|
|
|
|
function deploy_main_website {
|
|
echo "c2vi: Deploying website to fes"
|
|
|
|
# compile
|
|
cargo build --release --no-default-features --features server --manifest-path $MIZE_SRC/packages/ppc/Cargo.toml
|
|
|
|
ssh fes rm /home/server/here/ppc
|
|
# upload
|
|
scp $MIZE_SRC/target/release/ppc fes:here
|
|
|
|
# restart service
|
|
ssh fe "sudo systemctl restart ppc"
|
|
}
|
|
|
|
function deploy_main_obsidian {
|
|
echo "c2vi: Deploying to local main obsidian vault..."
|
|
|
|
deno run --config $MIZE_SRC/packages/ppc/platform/obsidian/deno.json build
|
|
|
|
cp -r $MIZE_SRC/packages/ppc/platform/obsidian/dist/* ~/work/things/.obsidian/plugins/ppc/
|
|
}
|
|
|
|
main "$@"
|