-
Notifications
You must be signed in to change notification settings - Fork 3
45 lines (40 loc) · 1.28 KB
/
destroy.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
name: Destroy
on:
delete:
workflow_dispatch:
inputs:
environment:
description: "Name of the environment to destroy:"
required: true
jobs:
destroy:
if: |
(
github.event.ref_type == 'branch' &&
(!startsWith(github.event.ref, 'skipci')) &&
(!contains(fromJson('["main", "staging", "production"]'), github.event.ref))
) ||
(
inputs.environment != '' &&
(!contains(fromJson('["main", "staging", "production"]'), inputs.environment))
)
runs-on: ubuntu-20.04
environment:
name: ${{ inputs.environment || (startsWith(github.event.ref, 'snyk-') && 'snyk' || github.event.ref) }}
env:
STAGE_NAME: ${{ inputs.environment || (startsWith(github.event.ref, 'snyk-') && 'snyk' || github.event.ref) }}
permissions:
id-token: write
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: ./.github/actions/setup
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }}
aws-region: us-east-1
role-duration-seconds: 10800
- name: Destroy
run: run destroy --stage $STAGE_NAME --verify false