#!/usr/bin/env bash
set -euxo pipefail
dotnet publish --self-contained -p:PublishSingleFile=true -p:DebugType=embedded -p:EnableCompressionInSingleFile=false -p:PublishReadyToRun=true -p:PublishTrimmed=false -p:DebuggerSupport=false -c Release -r linux-arm64

ssh afrapay@afrapay.lan sudo systemctl stop afrapay-web
ssh afrapay@afrapay.lan /usr/local/bin/afrapay-backup-database.sh
scp -r ./bin/Release/net7.0/linux-arm64/publish afrapay@afrapay.lan:/opt/afrapay
ssh afrapay@afrapay.lan sudo systemctl restart afrapay-web
