Dismantle staging #132
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
# Dismantles the demos from the staging environment when the corresponding branch is deleted | |
# | |
# Jobs: | |
# - TODO | |
# | |
name: Dismantle staging | |
# Controls when the action will run | |
on: | |
delete | |
# Array of jobs to run in this workflow | |
jobs: | |
delete: | |
if: github.event.ref_type == 'branch' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete S3 files | |
run: | | |
echo "Clean up for branch ${{ github.event.ref }}" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_STAGING }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_STAGING }} | |
aws-region: eu-west-2 | |
- name: Delete this branch's demos in the S3 bucket | |
run: | | |
aws s3 rm s3://wiris-integrations-staging-html/${{ github.event.ref }} --recursive | |
- name: Invalidate CloudFront cache | |
run: aws cloudfront create-invalidation --distribution-id $(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items!=null] | [?contains(Aliases.Items, 'integrations.wiris.kitchen')].Id | [0]" --output text) --paths '/*' |