Skip to content

S3 backup

S3 backup #664

Workflow file for this run

name: S3 backup
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * *"
env:
BACKUP_BRANCH: main
jobs:
s3-backup:
runs-on: ubuntu-latest
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@50ac8dd1e1b10d09dac7b8727528b91bed831ac0 # v3.0.2
with:
aws-access-key-id: ${{ secrets.AWS_S3_BACKUP_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_BACKUP_SECRET_ACCESS_KEY }}
aws-region: ca-central-1
- name: Get ZIP bundle
run: |
mkdir -p ${{ github.repository }}
curl -Lo ${{ github.repository }}/`basename ${{ github.repository }}`-`date '+%Y-%m-%d'`.zip \
https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}/archive/${{ env.BACKUP_BRANCH }}.zip
- name: Upload to S3 bucket
run: |
aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*'