Skip to content

Commit f491f27

Browse files
chore: synced local '.github/workflows/s3-backup.yml' with remote 'tools/sre_file_sync/s3-backup.yml'
1 parent 0563ce7 commit f491f27

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

.github/workflows/s3-backup.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
schedule:
55
- cron: "0 6 * * *"
66

7+
permissions:
8+
id-token: write
9+
contents: read
10+
711
jobs:
812
s3-backup:
913
runs-on: ubuntu-latest
@@ -13,24 +17,20 @@ jobs:
1317
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1418
with:
1519
fetch-depth: 0 # retrieve all history
20+
persist-credentials: false
1621

1722
- name: Configure AWS credentials
18-
uses: aws-actions/configure-aws-credentials@ececac1a45f3b08a01d2dd070d28d111c5fe6722 # v4.1.0
23+
uses: aws-actions/configure-aws-credentials@00943011d9042930efac3dcd3a170e4273319bc8 # v5.1.0
1924
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 }}
25+
role-to-assume: ${{ secrets.AWS_S3_BACKUP_IAM_ROLE_ARN }}
26+
role-session-name: S3Backup
2227
aws-region: ca-central-1
2328

24-
- name: Create ZIP bundle
29+
- name: Upload zip to S3 bucket
2530
run: |
2631
ZIP_FILE=`basename ${{ github.repository }}`-`date '+%Y-%m-%d'`.zip
2732
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 }}/*'
33+
aws s3 cp "${ZIP_FILE}" s3://${{ secrets.AWS_S3_BACKUP_BUCKET }}/${{ github.repository }}/"${ZIP_FILE}"
3434
3535
- name: Notify Slack channel if this job failed
3636
if: ${{ failure() }}

0 commit comments

Comments
 (0)