diff --git a/.github/scripts/clear-s3-caches-pattern.sh b/.github/scripts/clear-s3-caches-pattern.sh index 3fcdf71c0..a99b7e6fc 100755 --- a/.github/scripts/clear-s3-caches-pattern.sh +++ b/.github/scripts/clear-s3-caches-pattern.sh @@ -1,13 +1,21 @@ set -e pattern=$1 - -echo "Clearing S3 caches for path: ${pattern}" +if [ -z "$2" ]; +then + echo "undefined" + path_with_pattern=$pattern +else + echo "defined" + dir=$2 + path_with_pattern="${dir}/${pattern}" +fi +echo "Clearing S3 caches for path: ${path_with_pattern}" #Flush AWS Cloudfront Cache -echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths '/${pattern}'" +echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths '${path_with_pattern}'" -#invalidation_json=`aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "/${pattern}"` +#invalidation_json=`aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --output json --paths "${path_with_pattern}"` #echo "Invalidation response: ${invalidation_json}" #invalidation_id=`echo $invalidation_json | jq -r '.Invalidation.Id'` #invalidation_status=`echo $invalidation_json | jq -r '.Invalidation.Status'` @@ -21,7 +29,12 @@ echo "aws cloudfront create-invalidation --distribution-id ECAO9Q8651L8M --outpu #echo "Final invalidation status: ${invalidation_status}" # Flush CloudFlare Cache -s3_url=s3://dist.springsource.com/ +if [ -z "$dir" ]; +then + s3_url="s3://dist.springsource.com/" +else + s3_url="s3://dist.springsource.com/${dir}/" +fi echo "aws s3 cp ${s3_url} . --recursive --include '${pattern}' --dryrun" files=`aws s3 cp ${s3_url} . --recursive --include "${pattern}" --dryrun` counter=0 diff --git a/.github/workflows/upload-nightly-downloads-page.yml b/.github/workflows/upload-nightly-downloads-page.yml index 22a27713d..0709fcba9 100644 --- a/.github/workflows/upload-nightly-downloads-page.yml +++ b/.github/workflows/upload-nightly-downloads-page.yml @@ -32,4 +32,4 @@ jobs: CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} CLOUDFLARE_CACHE_TOKEN: ${{ secrets.CLOUDFLARE_CACHE_TOKEN }} run: | - ${{ github.workspace }}/.github/scripts/clear-s3-caches-pattern.sh snapshot/STS4/nightly-distributions.html + ${{ github.workspace }}/.github/scripts/clear-s3-caches-pattern.sh nightly-distributions.html snapshot/STS4