.github/workflows/delete.yaml
Overview
When a deployment is initiated, three configuration files are automatically generated. They are the:
- .art/art.yaml
- .github/workflows/argonaut-<envname>-<appname>-deploy.yaml
- .github/workflows/argonaut-<envname>-<appname>-delete.yaml
This section provides a breakdown of the .github/workflows/argonaut-<envname>-<appname>-delete.yaml
file and explains the functioning.
File breakdown
This file is triggered when you initiate a delete action on the branch or app (from the dashboard). The corresponding .github/workflows/argonaut-<envname>-<appname>-delete.yaml
file for an app is created in the branch of deployment and also in the default branch previews branch.
The only job run in this file is the delete job.
repo/.github/workflows/appName-delete.yaml
name: "Delete corresponding App on branch delete"
on:
delete:
workflow_dispatch:
jobs:
delete:
environment:
name: {environment}
runs-on: ubuntu-latest
name: Deleting App
steps:
- name: Fetch repo
uses: actions/checkout@v2
- name: Fetch Branch
run: echo "Clean up for the branch ${{ github.event.ref }}"
- name: Download art
run: curl --silent https://github.com/argonautdev/public/releases/latest/download/art-linux -L -o art
- name: Configure art
run: |
chmod +x ./art
sudo mv ./art /usr/local/bin/art
art configure --key ${{ secrets.ART_KEY }} --secret ${{ secrets.ART_SECRET }}
art app delete -f .art/argonaut-{environment}{app-name}.yaml --set appName="{app-name}-${{ github.event.ref }}"
The delete job is carried out in a few steps
- The first two steps, fetch repo and fetch branch does exactly what the name suggests. The fetch branch script then prints the branch in the output.
- The next step downloads the art cli, which is Argonaut's command-line interface. The cli is essential to run the delete shell scripts.
- The last step configures the art cli and then finally runs the script that deletes the app.