Deploy #64
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |