Add workflow to backup production DB #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Backup production database | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 4 * * *" # 04:00 UTC | |
push: | |
branches: | |
- backup-db | |
jobs: | |
backup: | |
name: Backup database | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: hashicorp/setup-terraform@v2 | |
with: | |
terraform_version: 1.5.0 | |
terraform_wrapper: false | |
- uses: DFE-Digital/github-actions/set-arm-environment-variables@master | |
with: | |
azure-credentials: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Get Azure backup storage details | |
id: azure-backup-storage | |
run: | | |
set -e | |
#make ci production_aks terraform-init | |
make ci production_aks | |
terraform -chdir=terraform/aks init -backend-config workspace_variables/production.backend.tfvars -reconfigure -input=false | |
echo "account-name=$(terraform -chdir=terraform/aks output -raw postgres_azure_backup_storage_account_name)" >> $GITHUB_OUTPUT | |
echo "container-name=$(terraform -chdir=terraform/aks output -raw postgres_azure_backup_storage_container_name)" >> $GITHUB_OUTPUT |