-
-
Notifications
You must be signed in to change notification settings - Fork 775
56 lines (48 loc) · 1.75 KB
/
ci-review-cleanup.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Cleanup review environment
# only trigger on pull request closed events
on:
pull_request:
types: [ closed ]
branches: [ master, stable ]
jobs:
cleanup:
# https://shipit.dev/posts/trigger-github-actions-on-pr-close.html
# We want to delete the stack regardless if it has been merged or not
name: Delete review stack
environment: review
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js
uses: actions/setup-node@v2
with:
cache: "npm"
cache-dependency-path: infra/review-pr/package-lock.json
# Install pulumi dependencies
# Select the new pulumi stack
- run: |
npm install
working-directory: infra/review-pr
- name: Compute some values
id: compute
run: |
echo "::set-output name=pulumi_stack::gitcoin/review/review-${{ github.event.number }}"
echo "::set-output name=review_domain::review-${{ github.event.number }}.review.gitcoin.co"
# Run pulumi actions
- name: Delete the pulumi stack
uses: pulumi/actions@v3
id: pulumi
with:
command: destroy
stack-name: ${{ steps.compute.outputs.pulumi_stack }}
work-dir: infra/review-pr
env:
PULUMI_ACCESS_TOKEN: ${{ secrets.PULUMI_ACCESS_TOKEN }}
PULUMI_CONFIG_PASSPHRASE: ${{ secrets.PULUMI_CONFIG_PASSPHRASE }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
DB_NAME: ${{ secrets.DB_NAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
DB_USER: ${{ secrets.DB_USER }}