From 447dc5da14975dccce755c971d53bb7045a89f46 Mon Sep 17 00:00:00 2001 From: Milosz Tyborowski Date: Tue, 7 Jul 2020 15:03:18 +0200 Subject: [PATCH] Cleanup S3 after decomissioning test environment --- .github/workflows/test-env-cleanup.yml | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/test-env-cleanup.yml diff --git a/.github/workflows/test-env-cleanup.yml b/.github/workflows/test-env-cleanup.yml new file mode 100644 index 000000000..79f9f2222 --- /dev/null +++ b/.github/workflows/test-env-cleanup.yml @@ -0,0 +1,27 @@ +name: TEST-ENV-CLEANUP + +on: + pull_request: + types: [closed] + branches: ["*"] + +jobs: + cleanup: + runs-on: ubuntu-latest + steps: + - uses: rlespinasse/github-slug-action@master + - name: Set domain + run: | + echo "::set-env name=domain::${{ env.GITHUB_HEAD_REF_SLUG }}.dashboard.saleor.rocks" + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_DEFAULT_REGION }} + + - name: Remove S3 directory + run: aws s3 rm s3://test-envs-stack-dashboards5d35b643-nempmfdd9fv/${{ env.domain }} + + - name: Invalidate cache + run: aws cloudfront create-invalidation --distribution-id E1INMM566C4FJP --paths "/${{ env.domain }}/*"