-
Notifications
You must be signed in to change notification settings - Fork 4
56 lines (48 loc) · 1.44 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
46
47
48
49
50
51
52
53
54
55
56
name: 'Destroy'
env:
DIGITALOCEAN_SSH_KEY_NAME: teamspeak-ci
DIGITALOCEAN_DROPLET_SIZE: s-1vcpu-1gb
DIGITALOCEAN_REGION: ams3
DIGITALOCEAN_VOLUME_SIZE: 3GiB
on:
workflow_dispatch:
inputs:
droplet-name:
description: 'Droplet name teamspeak'
required: true
default: "teamspeak"
droplet-volume:
description: 'Droplet volume database'
required: true
default: "database"
jobs:
destroy-droplet:
name: Destroy droplet
runs-on: ubuntu-latest
steps:
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Destroy droplet
id: destroy-droplet
continue-on-error: true
run: |
doctl compute droplet delete -f ${{ github.event.inputs.droplet-name }}
destroy-volume:
name: Destroy volume
runs-on: ubuntu-latest
needs:
- destroy-droplet
steps:
- name: Install doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
- name: Get volume id
id: get-volume
run: echo "::set-output name=id::$(doctl compute volume ls --format ID,Name | grep ${{ github.event.inputs.droplet-volume }} | cut -d ' ' -f1)"
- name: Destroy Volume
id: destroy-droplet
run: |
doctl compute volume delete -f ${{ steps.get-volume.outputs.id }}