Files
jobtrackingapp/.gitea/workflows/backup.yml
T
cesnimda de85492373
CI and Deploy / test (push) Successful in 6m47s
CI and Deploy / deploy (push) Failing after 25s
feat(ops): automate backups and private CV benchmarks
2026-09-02 00:49:06 +02:00

33 lines
1008 B
YAML

name: Production backup
on:
schedule:
# One of these UTC hours is 02:00 in Europe/Oslo; the guard skips the other.
- cron: '0 0,1 * * *'
workflow_dispatch:
jobs:
backup:
runs-on: ubuntu-latest
steps:
- name: Create verified production recovery set
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.PROD_HOST }}
username: ${{ secrets.PROD_USER }}
key: ${{ secrets.PROD_SSH_KEY }}
command_timeout: 20m
script: |
set -euo pipefail
if [ "${{ github.event_name }}" = "schedule" ] \
&& [ "$(TZ=Europe/Oslo date +%H)" != "02" ]; then
echo "Outside the 02:00 Europe/Oslo backup window."
exit 0
fi
cd /opt/job-tracker/app
if [ ! -x deploy/deploy.sh ]; then
echo "The deployed backup script is unavailable."
exit 1
fi
DEPLOY_BACKUP_ONLY=true deploy/deploy.sh