-
Notifications
You must be signed in to change notification settings - Fork 158
40 lines (32 loc) · 1.11 KB
/
preview-branches-close.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
name: Destroy Preview Branch
on:
pull_request:
types: [closed]
# Require previous builds and deployments to finish before starting a new one
# Close can not run concurrently with Create or Update Infrastructure with Pulumi
concurrency:
group: pr-${{ github.event.pull_request.number }}
jobs:
teardown:
name: Destroy Pulumi Infrastructure Stack
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- uses: pulumi/actions@v4
- name: Destroy Infrastructure Stack
working-directory: infra
run: |
npm ci
pulumi org set-default quadratic
STACK_NAME="preview-pr-${{ env.PR_ID }}"
pulumi stack select $STACK_NAME
pulumi config set aws:region us-west-2
pulumi destroy -y --remove
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_DEVELOPMENT }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_DEVELOPMENT }}
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PR_ID: ${{ github.event.pull_request.number }}