Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

⬆️ Update dependency eslint-plugin-unicorn to v50 #812

⬆️ Update dependency eslint-plugin-unicorn to v50

⬆️ Update dependency eslint-plugin-unicorn to v50 #812

name: Destroy backend preview
on:
pull_request:
branches: [master]
types: [closed]
env:
IMAGE_NAME: 'ghcr.io/${{ github.repository }}'
jobs:
destroy_vercel_preview:
name: 'Destroy Vercel preview'
runs-on: ubuntu-latest
steps:
- name: Destroy Vercel preview
uses: snaplet/vercel-action@v3
with:
delete: true
env:
VERCEL_ACCESS_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_PROJECT_ID: prj_8VUZLEU0bcCYk0j9aHHgorqmtuM0
VERCEL_TEAM_ID: team_BalajEhvjfBqbkouJFI9761w
GITHUB_TOKEN: ${{ secrets.REPO_PAT }}
destroy_backend_preview:
name: 'Destroy backend preview'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_wrapper: false
- name: Set environment variables
id: env_vars
run: |
echo "BRANCH_NAME_FORMATTED=$(echo "$BRANCH_NAME" | sed -e 's/-*login-*//g' -e 's/renovate\///g' -e 's/frontend/f/g' -e 's/backend/b/g' -e 's/[\/_\.]/-/g')" >> $GITHUB_OUTPUT
echo "BACKEND_TAG=$BACKEND_TAG" >> $GITHUB_OUTPUT
env:
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
BACKEND_TAG: ${{ steps.changed-files.outputs.any_changed == 'true' && github.sha || 'latest' }}
- name: Destroy preview container
run: |
cd terraform/preview
terraform init -lockfile=readonly
terraform workspace select $WORKSPACE_NAME && \
terraform destroy -auto-approve -lock-timeout=15m && \
terraform workspace select default && \
terraform workspace delete $WORKSPACE_NAME || true
env:
TF_VAR_rg_name: 'echo-web-${{ steps.env_vars.outputs.BRANCH_NAME_FORMATTED }}'
TF_VAR_db_password: ${{ secrets.DB_PASSWORD_DEV }}
TF_VAR_backend_image: '$IMAGE_NAME/backend:$BACKEND_TAG'
TF_VAR_admin_key: ${{ secrets.ADMIN_KEY_DEV }}
TF_VAR_auth_secret: ${{ secrets.AUTH_SECRET }}
ARM_CLIENT_ID: ${{ secrets.ARM_CLIENT_ID }}
ARM_CLIENT_SECRET: ${{ secrets.ARM_CLIENT_SECRET }}
ARM_SUBSCRIPTION_ID: ${{ secrets.ARM_SUBSCRIPTION_ID }}
ARM_TENANT_ID: ${{ secrets.ARM_TENANT_ID }}
WORKSPACE_NAME: ${{ steps.env_vars.outputs.BRANCH_NAME_FORMATTED }}