[CICD] Clear Auto Update Cache For Katalon Studio #7
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: "[CICD] Clear Auto Update Cache For Katalon Studio" | |
on: | |
workflow_dispatch: | |
inputs: | |
cloudfront_id: | |
description: CloudFront Id | |
required: true | |
default: E1S9HCHW5N31CV | |
cloudfront_object_paths: | |
description: Object Paths to invalidate cache | |
required: true | |
default: '/update/latest_v9_version.json' | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
invalidate_cache: | |
runs-on: ubuntu-latest | |
name: Clear Auto Update Cache Katalon Studio | |
environment: prod | |
steps: | |
### AWS Config | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
role-to-assume: arn:aws:iam::${{ vars.AWS_ACCOUNT_ID }}:role/katalon-github-oidc-federation | |
role-session-name: github-actions | |
aws-region: ${{ vars.AWS_REGION }} | |
mask-aws-account-id: 'no' | |
- name: Clear CloudFront cache | |
id: clear_cache | |
shell: bash | |
run: | | |
CLOUDFRONT_OBJECT_PATHS="${{ inputs.cloudfront_object_paths }}" | |
PATHS=($( | |
echo "${CLOUDFRONT_OBJECT_PATHS}" | tr ' ' '\n' | |
)) | |
CLOUDFRONT_ID=${{ inputs.cloudfront_id }} | |
for path in "${PATHS[@]}"; do | |
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "$path" --output text | |
done |