generated from cds-snc/project-template
-
Notifications
You must be signed in to change notification settings - Fork 4
30 lines (25 loc) · 961 Bytes
/
s3-backup.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 }}/*'