mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-30 13:10:47 +00:00
Merge pull request #11 from Hestia-Homes/main
Pull out branch name from the environment github ref
This commit is contained in:
commit
4eab76fed3
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:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
|
||||||
- dev
|
- dev
|
||||||
- prod
|
- prod
|
||||||
|
|
||||||
|
|
@ -49,12 +48,15 @@ jobs:
|
||||||
run: cd infrastructure/terraform && terraform init
|
run: cd infrastructure/terraform && terraform init
|
||||||
|
|
||||||
- name: Terraform Plan
|
- 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
|
- name: Terraform Workspace
|
||||||
run: |
|
run: |
|
||||||
|
BRANCH_NAME=$(echo "${{ github.ref }}" | sed -e "s/^refs\/heads\///")
|
||||||
cd infrastructure/terraform
|
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
|
- name: Deploy to Dev
|
||||||
if: github.ref == 'refs/heads/dev'
|
if: github.ref == 'refs/heads/dev'
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue