-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
37 lines (37 loc) · 1.13 KB
/
action.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
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
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
if [ -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
fi