I wrote a GitHub CI action to deploy on AWS using terraform.
I wonder if it is possible to implement something similar to GitLab CI and add a step to destroy the infrastructure that is manually triggered like:
Staging Destroy:
stage: Destroy
script:
- cd deploy/terraform/
- terraform init
- terraform workspace select staging
- terraform destroy -auto-approve
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|production)$/'
when: manual
CodePudding user response:
You can trigger manually with workflow_dispatch
and add a conditional to check branch name:
name: "Staging Destroy"
on:
workflow_dispatch:
jobs:
destroy:
if: github.ref == 'refs/heads/master' || github.ref == 'ref/heads/production'
...