Cleanup package.json scripts
#3623
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: Testing | |
| # Remove test instance for closed pull requests | |
| on: | |
| pull_request: | |
| types: [closed] | |
| jobs: | |
| cleanup: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| id-token: write # needed by aws-actions/configure-aws-credentials | |
| contents: read | |
| deployments: write | |
| steps: | |
| - uses: rlespinasse/github-slug-action@3.1.0 | |
| - name: Set domain | |
| id: set-domain | |
| # Set test instance domain based on branch name slug | |
| run: | | |
| echo "domain=${{ env.GITHUB_HEAD_REF_SLUG_URL }}.dashboard.saleor.rocks" >> $GITHUB_OUTPUT | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| role-to-assume: arn:aws:iam::${{ secrets.AWS_TESTENVS_ACCOUNT_ID }}:role/${{ secrets.AWS_DASHBOARD_TESTENVS_CICD_ROLE_NAME }} | |
| aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
| - name: Remove S3 directory | |
| run: aws s3 rm --recursive s3://${{ secrets.AWS_TEST_DEPLOYMENT_BUCKET }}/${{ steps.set-domain.outputs.domain }}/ | |
| - name: Invalidate cache | |
| run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_TEST_CF_DIST_ID }} --paths "/${{ steps.set-domain.outputs.domain }}/*" | |
| - name: Mark deployment as deactivated | |
| uses: bobheadxi/deployments@v0.4.2 | |
| with: | |
| step: deactivate-env | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| env: ${{ env.GITHUB_HEAD_REF_SLUG_URL }} |