Skip to content

S3 backup

S3 backup #650

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@5fd3084fc36e372ff1fff382a39b10d03659f355 # v2.2.0
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 }}/*'