mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
Pull out branch name from the environment github ref
This commit is contained in:
parent
69362570b8
commit
7e9ffedbe6
1 changed files with 5 additions and 3 deletions
8
.github/workflows/deploy_terraform.yml
vendored
8
.github/workflows/deploy_terraform.yml
vendored
|
|
@ -3,7 +3,6 @@ name: CI/CD Pipeline
|
|||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
- prod
|
||||
|
||||
|
|
@ -49,12 +48,15 @@ jobs:
|
|||
run: cd infrastructure/terraform && terraform init
|
||||
|
||||
- name: Terraform Plan
|
||||
run: cd infrastructure/terraform && terraform plan -var-file=${{ github.event.pull_request.base.ref }}.tfvars
|
||||
run: |
|
||||
BRANCH_NAME=$(echo "${{ github.ref }}" | sed -e "s/^refs\/heads\///")
|
||||
cd infrastructure/terraform && terraform plan -var-file=${BRANCH_NAME}.tfvars
|
||||
|
||||
- name: Terraform Workspace
|
||||
run: |
|
||||
BRANCH_NAME=$(echo "${{ github.ref }}" | sed -e "s/^refs\/heads\///")
|
||||
cd infrastructure/terraform
|
||||
terraform workspace select ${{ github.event.pull_request.base.ref }} || terraform workspace new ${{ github.event.pull_request.base.ref }}
|
||||
terraform workspace select ${BRANCH_NAME} || terraform workspace new ${BRANCH_NAME}
|
||||
|
||||
- name: Deploy to Dev
|
||||
if: github.ref == 'refs/heads/dev'
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue