2021-08-28 20:36:52 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2021-08-29 20:20:29 +00:00
|
|
|
# This script should be called with the name of the branch to deploy. ($1 will
|
|
|
|
# be the branch name.)
|
2021-08-28 20:36:52 +00:00
|
|
|
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
sudo -u hmn bash -s <<SCRIPT
|
|
|
|
set -euo pipefail
|
|
|
|
pushd /home/hmn/hmn
|
|
|
|
git fetch --all
|
|
|
|
git reset --hard $1
|
2021-08-29 20:20:29 +00:00
|
|
|
go build -o /home/hmn/bin/hmn src/main.go
|
2021-08-28 20:36:52 +00:00
|
|
|
popd
|
|
|
|
SCRIPT
|
|
|
|
|
2021-08-29 20:20:29 +00:00
|
|
|
systemctl stop hmn
|
2021-08-28 20:36:52 +00:00
|
|
|
sudo -u hmn bash -s <<'SCRIPT'
|
|
|
|
set -euo pipefail
|
2021-08-29 20:20:29 +00:00
|
|
|
/home/hmn/bin/hmn migrate
|
2021-08-28 20:36:52 +00:00
|
|
|
SCRIPT
|
2021-08-29 20:20:29 +00:00
|
|
|
systemctl start hmn
|