-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
88 lines (88 loc) · 3.01 KB
/
Copy pathaction.yml
File metadata and controls
88 lines (88 loc) · 3.01 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: "delstack-action"
author: "k.goto"
description: "Run delstack in GitHub Actions"
branding:
icon: "command"
color: "blue"
inputs:
stack-name:
description: "Names of one or multiple stacks you want to delete (comma separated)"
required: false
region:
description: "AWS Region"
default: "us-east-1"
required: false
force:
description: "Force Mode to delete stacks including resources with the deletion policy Retain or RetainExceptOnCreate"
default: false
required: false
yes:
description: "Skip confirmation prompts (e.g., TerminationProtection disable confirmation)"
default: true
required: false
concurrency-number:
description: "Number of parallel stack deletions (default: unlimited)"
required: false
cdk:
description: "Enable CDK mode: synthesize or read cdk.out and delete all stacks"
default: false
required: false
cdk-app:
description: "Path to an existing cdk.out directory (skips synthesis). Only used when cdk is true."
required: false
cdk-context:
description: "CDK context values (comma separated key=value pairs). Only used when cdk is true."
required: false
runs:
using: "composite"
steps:
- shell: bash
run: |
set -eu
if [ ! -e /usr/local/bin/delstack ]; then
DOWNLOAD_URL=$(curl https://api.github.com/repos/go-to-k/delstack/releases/latest | jq -r '.assets[].browser_download_url|select(match("Linux_x86_64."))')
cd /tmp
curl -sfLO ${DOWNLOAD_URL}
FILENAME=$(basename $DOWNLOAD_URL)
tar xzvf ${FILENAME}
chmod +x delstack
sudo mv delstack /usr/local/bin/
rm ${FILENAME}
fi
force=""
if [ "${{ inputs.force }}" = "true" ]; then
force="-f"
fi
yes=""
if [ "${{ inputs.yes }}" = "true" ]; then
yes="-y"
fi
concurrency=""
if [ -n "${{ inputs.concurrency-number }}" ]; then
concurrency="-n ${{ inputs.concurrency-number }}"
fi
if [ "${{ inputs.cdk }}" = "true" ]; then
cdk_app=""
if [ -n "${{ inputs.cdk-app }}" ]; then
cdk_app="-a ${{ inputs.cdk-app }}"
fi
cdk_context=""
if [ -n "${{ inputs.cdk-context }}" ]; then
for ctx in $(echo "${{ inputs.cdk-context }}" | tr ',' ' '); do
cdk_context="${cdk_context}-c ${ctx} "
done
fi
stacks=""
if [ -n "${{ inputs.stack-name }}" ]; then
for stack in $(echo ${{ inputs.stack-name }} | tr ',' ' '); do
stacks="${stacks}-s ${stack} "
done
fi
delstack cdk $stacks $cdk_app $cdk_context $force $yes $concurrency
elif [ -n "${{ inputs.stack-name }}" ]; then
stacks=""
for stack in $(echo ${{ inputs.stack-name }} | tr ',' ' '); do
stacks="${stacks}-s ${stack} "
done
delstack -r ${{ inputs.region }} $stacks $force $yes $concurrency
fi