From 72fec5433610df6e5f405e7f2d8eca1d492c5b2a Mon Sep 17 00:00:00 2001 From: Samuel Wilhelmsson Date: Fri, 10 Jan 2025 23:47:43 +0100 Subject: Update deploy script to janet Update styles with more fancy font --- deploy | 46 +++++++++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 15 deletions(-) (limited to 'deploy') diff --git a/deploy b/deploy index 2946fc8..6bb97ee 100755 --- a/deploy +++ b/deploy @@ -1,21 +1,37 @@ -USER=fnurk -HOST=samuelw.dev -BIN_DIR=/opt/tinygram/ # the directory where your binary should go -ASSET_DIR=/srv/tinygram/ # the directory where your asset dir should go +#!/usr/bin/env janet +(use sh) -echo "generating templates" -templ generate +(def user "fnurk") +(def host "samuelw.dev") -echo "building" -go build . +(def bin-dir "/opt/tinygram/") +(def asset-dir "/srv/tinygram/") -echo "syncing binary" -rsync --rsync-path 'sudo -u tinygram rsync' tinygram ${USER}@${HOST}:${BIN_DIR} +(def ssh-target (string user "@" host)) -echo "syncing assets" -rsync --rsync-path 'sudo -u tinygram rsync' -r assets ${USER}@${HOST}:${ASSET_DIR} +(def bin-target (string ssh-target ":" bin-dir)) +(def asset-target (string ssh-target ":" asset-dir)) -echo "restarting service" -ssh ${USER}@${HOST} 'sudo systemctl restart tinygram.service' +(def rsync-path ["--rsync-path" "sudo -u tinygram rsync"]) -exit 0 +(def rsync-bin-args [;rsync-path "tinygram" bin-target]) +(def rsync-asset-args [;rsync-path "-r" "assets" asset-target]) + + +(print "-- building templ --") +($ templ generate) + +(print "-- building go --") +($ go build ".") + +(print "-- syncing binary --") +($ rsync ;rsync-bin-args) + +(print "-- syncing assets --") +($ rsync ;rsync-asset-args) + + +(print "-- restarting service --") +($ ssh ,ssh-target "sudo systemctl restart tinygram.service") + +(print "done!") -- cgit v1.2.3