12 Commits

Author SHA1 Message Date
sid palas
f21960b178 update tag filter 2021-05-27 17:20:55 -07:00
sid palas
7ac8179ed7 remove ls workflow step 2021-05-27 17:17:00 -07:00
sid palas
99fa5aa790 revert test filter 2021-05-27 17:15:44 -07:00
sid palas
b9126d2648 remove undeclared variable 2021-05-27 17:08:57 -07:00
sid palas
9904d34734 Merge branch 'main' into feature/test-filters 2021-05-27 16:59:25 -07:00
sid palas
158d863b3a list parent dir 2021-05-27 16:53:15 -07:00
sid palas
3d18f52dfa set working directory for each step 2021-05-27 16:47:32 -07:00
sid palas
d040956dae remove step working directories 2021-05-27 16:36:04 -07:00
sid palas
314a68cc9b use relative path 2021-05-27 16:34:56 -07:00
sid palas
563bef8b73 echo pwd before init 2021-05-27 16:32:06 -07:00
sid palas
00bde26962 swap staging and production, add global apply 2021-05-27 16:26:23 -07:00
sid palas
934164b7ec add test on branch 2021-05-27 16:17:25 -07:00

View File

@@ -5,7 +5,7 @@ on:
branches:
- main
tags:
- v\d+\.\d+\.\d+$
- v[0-9]+\.[0-9]+\.[0-9]+$
pull_request:
jobs:
@@ -75,17 +75,25 @@ jobs:
- name: Check tag
id: check-tag
run: |
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
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
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 == 'production' && github.event_name == 'push'
working-directory: 07-managing-multiple-environments/file-structure/staging
if: steps.check-tag.outputs.environment == 'staging' && github.event_name == 'push'
run: terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
- name: Terraform Apply Production
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/production
run: terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
run: |
terraform init
terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve