-
Notifications
You must be signed in to change notification settings - Fork 2
57 lines (54 loc) · 1.49 KB
/
deploy.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
57
name: Deploy
on:
workflow_dispatch:
push:
tags:
- "*"
concurrency:
group: deploy
cancel-in-progress: true
jobs:
bake:
name: Build and push
uses: ./.github/workflows/bake.yml
secrets: inherit
test:
name: Deploy to test.islandora.ca
needs: bake
uses: ./.github/workflows/create.yml
secrets: inherit
with:
environment: test
environment_url: https://test.islandora.ca
sandbox:
needs: test
name: Deploy to sandbox.islandora.ca
uses: ./.github/workflows/create.yml
secrets: inherit
with:
environment: sandbox
environment_url: https://sandbox.islandora.ca
cleanup:
name: Destroy test.islandora.ca
if: success()
needs: sandbox # Blocked by approval for sandbox.
runs-on: ubuntu-latest
environment:
name: test
url: https://test.islandora.ca
steps:
- name: Set up doctl
uses: digitalocean/action-doctl@v2
with:
token: ${{ secrets.DIGITALOCEAN_API_TOKEN }}
- name: Get droplet ID
id: get_droplet
run: |
name="test"
droplet_id=$(doctl compute droplet list --format ID,Name --no-header | grep " ${name}\$" | awk '{print $1}')
echo "droplet_id=$droplet_id" >> $GITHUB_OUTPUT
- name: Destroy droplet
if : ${{ steps.get_droplet.outputs.droplet_id != '' }}
run: |
droplet_id="${{ steps.get_droplet.outputs.droplet_id }}"
doctl compute droplet delete "$droplet_id" --force