www/.github/workflows/cleanup.yml

45 lines
1.4 KiB
YAML
Raw Permalink Normal View History

on:
pull_request:
types:
- closed
jobs:
clean-up:
runs-on: ubuntu-latest
steps:
- name: inject slug/short variables
uses: rlespinasse/github-slug-action@v3.x
2022-07-07 23:18:49 +03:00
- name: Set STAGE variable in environment for next steps
run: echo "STAGE=pr-${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV
2022-07-07 23:18:49 +03:00
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
# there is a bug with the actions/cache used in bahmutov/npm-install@v1 on "closed" event
# more infos here : https://github.com/actions/cache/issues/478
2022-07-07 23:18:49 +03:00
- run: yarn --frozen-lockfile
2022-06-15 17:04:18 +03:00
working-directory: .cdk
2022-07-07 23:18:49 +03:00
- 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: us-east-1
2022-06-15 21:53:15 +03:00
# Interestingly, `cdk` uses a hash of the directory path, and if it doesn't exist, it can't hash it.
- name: lol wut? don't look at this.
run: mkdir public
2022-07-07 23:18:49 +03:00
- name: Destroy the stack on AWS
run: yarn destroy
2022-06-15 17:04:18 +03:00
working-directory: .cdk
2022-07-07 23:18:49 +03:00
- name: Delete the github deployments and the corresponding environment
uses: strumwolf/delete-deployment-environment@v1.1.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
2022-07-07 23:18:49 +03:00
environment: ${{ env.STAGE }}