Invalidate CloudFront asset bucket cache #6
This file contains hidden or 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: Invalidate CloudFront asset bucket cache | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'The environment used as target' | |
type: choice | |
required: true | |
default: dev | |
options: | |
- dev | |
- uat | |
- prod | |
# Permissions needed for AWS OIDC authentication | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
invalidate_cloudfront_asset_bucket_cache: | |
name: Invalidate CloudFront asset bucket cache (manual on ${{ inputs.environment }}) | |
runs-on: ubuntu-latest | |
environment: ${{ inputs.environment }} | |
env: | |
ENV_SHORT: ${{ fromJSON('{"dev":"d","uat":"u","prod":"p"}')[inputs.environment] }} | |
steps: | |
- name: Checkout current repository | |
uses: actions/checkout@v4 | |
- name: Configure AWS Credentials | |
uses: ./.github/actions/configure-aws-credentials | |
with: | |
aws_region: eu-south-1 | |
role_to_assume: ${{ secrets.DEPLOY_IAM_ROLE }} | |
- name: Invalidate CloudFront asset bucket cache | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id ${{ vars.ASSET_BUCKET_CLOUDFRONT_DISTRIBUTION_ID }} \ | |
--paths "/*" |