Skip to content
This repository was archived by the owner on Mar 4, 2022. It is now read-only.

Commit ac4d7ba

Browse files
chore: Created local '.github/workflows/s3-backup.yml' from remote 'tools/sre_file_sync/s3-backup.yml'
1 parent bcbb1d8 commit ac4d7ba

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

.github/workflows/s3-backup.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: S3 backup
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 6 * * *"
6+
7+
jobs:
8+
s3-backup:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # retrieve all history
16+
17+
- name: Configure AWS credentials
18+
uses: aws-actions/configure-aws-credentials@v1
19+
with:
20+
aws-access-key-id: ${{ secrets.AWS_S3_BACKUP_ACCESS_KEY_ID }}
21+
aws-secret-access-key: ${{ secrets.AWS_S3_BACKUP_SECRET_ACCESS_KEY }}
22+
aws-region: ca-central-1
23+
24+
- name: Create ZIP bundle
25+
run: |
26+
ZIP_FILE=`basename ${{ github.repository }}`-`date '+%Y-%m-%d'`.zip
27+
zip -rq "${ZIP_FILE}" .
28+
mkdir -p ${{ github.repository }}
29+
mv "${ZIP_FILE}" ${{ github.repository }}
30+
31+
- name: Upload to S3 bucket
32+
run: |
33+
aws s3 sync . s3://${{ secrets.AWS_S3_BACKUP_BUCKET }} --exclude='*' --include='${{ github.repository }}/*'

0 commit comments

Comments
 (0)