From 09d5a5a27f6397eb197a4a98c4ed97cbf52ba680 Mon Sep 17 00:00:00 2001 From: Andrei Nakagawa Date: Mon, 16 May 2022 21:22:34 +1200 Subject: [PATCH] feat: adding github actions to backup repository to s3 --- .github/workflows/github_backup.yaml | 33 ++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/github_backup.yaml diff --git a/.github/workflows/github_backup.yaml b/.github/workflows/github_backup.yaml new file mode 100644 index 000000000..0ef29abd0 --- /dev/null +++ b/.github/workflows/github_backup.yaml @@ -0,0 +1,33 @@ +name: Mirror repository to S3 +on: + push: + branches: + - master +jobs: + BackupRepoToS3: + runs-on: ubuntu-latest + permissions: + contents: read + id-token: write + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure aws credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-region: ap-southeast-2 + role-to-assume: arn:aws:iam::817632051851:role/oidc-github-actions-mattrglobal-global + role-duration-seconds: 900 + role-session-name: GithubActions + + - name: Backing up this repo to AWS S3 + uses: peter-evans/s3-backup@v1 + env: + AWS_REGION: ${{ env.AWS_REGION }} + ACCESS_KEY_ID: ${{ env.AWS_ACCESS_KEY_ID }} + MIRROR_TARGET: mattrglobal-github-backup/pdf-lib + SECRET_ACCESS_KEY: ${{ env.AWS_SECRET_ACCESS_KEY }} + AWS_SESSION_TOKEN: ${{ env.AWS_SESSION_TOKEN }} + with: + args: --overwrite --remove \ No newline at end of file