Merge pull request #252 from phellen007/main #582
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/* |