Skip to content

Destroy environment #24

Destroy environment

Destroy environment #24

name: Destroy environment
on:
delete:
defaults:
run:
working-directory: devops/scripts
jobs:
test:
if: github.event.ref != 'main' && github.event.ref != 'production'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20.17"
- name: Get environment name
id: env_name
run: |
env_name=$(node get-environment-name.js ${{ github.event.ref }})
echo "env_name: $env_name"
echo "env_name=$env_name" >> $GITHUB_OUTPUT
- name: Destroy environment
env:
SCW_SECRET_KEY: ${{ secrets.SCW_CI_DEPLOY_SECRET_KEY }}
SCW_ORGANIZATION_ID: ${{ secrets.SCW_ORGANIZATION_ID }}
run: node destroy-environment.js ${{ steps.env_name.outputs.env_name }}