10 Commits

Author SHA1 Message Date
sid palas
771b8b16da remove extra echo step 2021-05-27 15:53:12 -07:00
sid palas
fd8eae8c36 echo check-tag output 2021-05-27 15:52:06 -07:00
sid palas
16ea290cee add echo to check-tag 2021-05-27 15:48:43 -07:00
sid palas
eabb75da33 add check tag step 2021-05-27 15:45:06 -07:00
sid palas
6bb2c4920e wrap condition in braces 2021-05-27 15:41:38 -07:00
sid palas
634ba2582a perform ref check in apply step 2021-05-27 15:40:23 -07:00
sid palas
fe309c5f70 add staging/production split 2021-05-27 15:34:00 -07:00
sid palas
364f66b53e move dns zone to global dir 2021-05-27 15:18:02 -07:00
sid palas
467323fee8 add db_pass secret 2021-05-27 14:54:00 -07:00
sid palas
8b76c065e9 add tf apply step 2021-05-27 14:49:45 -07:00

View File

@@ -5,7 +5,7 @@ on:
branches:
- main
tags:
- v[0-9]+\.[0-9]+\.[0-9]+$
- v\d+\.\d+\.\d+$
pull_request:
jobs:
@@ -75,25 +75,17 @@ jobs:
- name: Check tag
id: check-tag
run: |
if [[ ${{ github.ref }} =~ "^refs\/tags\/v[0-9]+\.[0-9]+\.[0-9]+$" ]]; then echo ::set-output name=environment::production
elif [[ ${{ github.ref }} == 'refs/heads/main' ]]; then echo ::set-output name=environment::staging
if [[ ${{ github.ref }} =~ ^refs/tags/vd+\.d+\.d+$ ]]; then echo ::set-output name=environment::production
elif [[ github.ref == 'refs/heads/main' ]]; then echo ::set-output name=environment::staging
else echo ::set-output name=environment::unknown
fi
- name: Terraform Apply Global
if: github.event_name == 'push'
working-directory: 07-managing-multiple-environments/file-structure/global
run: |
terraform init
terraform apply -auto-approve
- name: Terraform Apply Staging
if: steps.check-tag.outputs.environment == 'staging' && github.event_name == 'push'
if: steps.check-tag.outputs.environment == 'production' && github.event_name == 'push'
working-directory: 07-managing-multiple-environments/file-structure/staging
run: terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
- name: Terraform Apply Production
if: steps.check-tag.outputs.environment == 'production' && github.event_name == 'push'
if: steps.check-tag.outputs.environment == 'staging' && github.event_name == 'push'
working-directory: 07-managing-multiple-environments/file-structure/production
run: |
terraform init
terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
run: terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve