hmn/server/deploy.sh

23 lines
426 B
Bash
Raw Normal View History

2021-08-28 20:36:52 +00:00
#!/bin/bash
# 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
go build -o /home/hmn/bin/hmn src/main.go
2021-08-28 20:36:52 +00:00
popd
SCRIPT
systemctl stop hmn
2021-08-28 20:36:52 +00:00
sudo -u hmn bash -s <<'SCRIPT'
set -euo pipefail
/home/hmn/bin/hmn migrate
2021-08-28 20:36:52 +00:00
SCRIPT
systemctl start hmn