-
Notifications
You must be signed in to change notification settings - Fork 42
41 lines (35 loc) · 1.18 KB
/
upload-to-s3.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
31
32
33
34
35
36
37
38
39
40
41
name: Upload Maps to S3
on:
push:
branches:
- main
workflow_dispatch:
permissions:
id-token: write
contents: read # This is required for actions/checkout
jobs:
UploadMapsToS3:
if: github.repository == 'FortuneStreetModding/fortunestreetmodding.github.io'
runs-on: ubuntu-latest
steps:
- name: Clone the repo
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.ASSUME_ROLE_ARN }}
role-session-name: ghamapuploadingrolesession
aws-region: ${{ secrets.AWS_REGION }}
- name: Zip maps
shell: bash
working-directory: ./_maps
run: |
for mapDir in *; do
cd ${mapDir}
zip -r ../${mapDir}.zip .
cd ..
done
- name: Upload maps to S3
run: aws s3 cp ./_maps s3://${{ secrets.S3_BUCKET_NAME }}/cswt/Maps --recursive --exclude "*" --include "*.zip"
- name: Create CloudFront invalidation for maps
run: aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths /cswt/Maps/*