summaryrefslogtreecommitdiff
path: root/deploy
blob: 6bb97ee7017e9eb455fb60e3020bcfee375d3701 (plain)
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
33
34
35
36
37
#!/usr/bin/env janet
(use sh)

(def user "fnurk")
(def host "samuelw.dev")

(def bin-dir "/opt/tinygram/")
(def asset-dir "/srv/tinygram/")

(def ssh-target (string user "@" host))

(def bin-target (string ssh-target ":" bin-dir))
(def asset-target (string ssh-target ":" asset-dir))

(def rsync-path ["--rsync-path" "sudo -u tinygram rsync"])

(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!")