#!/bin/bash
bazel build -c opt //hg-web:hg_web_server_bundle

# Create
sudo cp -a bazel-bin/hg-web/hg_web_server_bundle /opt/hg_web_server_bundle_new
sudo chown -R hg_web_server:zenbu_team /opt/hg_web_server_bundle_new

# Swap
sudo rm -rf /opt/hg_web_server_bundle_active
sudo mv /opt/hg_web_server_bundle_new /opt/hg_web_server_bundle_active

sudo systemctl restart hg_web_server.service
echo "Deployment complete!"
