File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,17 +75,25 @@ jobs:
7575 - name : Check tag
7676 id : check-tag
7777 run : |
78- if [[ ${{ github.ref }} =~ ^refs/tags/vd +\.d +\.d+$ ]]; then echo ::set-output name=environment::production
79- elif [[ github.ref == 'refs/heads/main' ]]; then echo ::set-output name=environment::staging
78+ if [[ ${{ github.ref }} =~ " ^refs\ /tags\/v[0-9] +\.[0-9] +\.[0-9]+$" ]]; then echo ::set-output name=environment::production
79+ elif [[ ${{ github.ref }} == 'refs/heads/main' ]]; then echo ::set-output name=environment::staging
8080 else echo ::set-output name=environment::unknown
8181 fi
8282
83+ - name : Terraform Apply Global
84+ if : github.event_name == 'push'
85+ working-directory : 07-managing-multiple-environments/file-structure/global
86+ run : |
87+ terraform init
88+ terraform apply -auto-approve
89+
8390 - name : Terraform Apply Staging
84- if : steps.check-tag.outputs.environment == 'production' && github.event_name == 'push'
85- working-directory : 07-managing-multiple-environments/file-structure/staging
91+ if : steps.check-tag.outputs.environment == 'staging' && github.event_name == 'push'
8692 run : terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
8793
8894 - name : Terraform Apply Production
89- if : steps.check-tag.outputs.environment == 'staging ' && github.event_name == 'push'
95+ if : steps.check-tag.outputs.environment == 'production ' && github.event_name == 'push'
9096 working-directory : 07-managing-multiple-environments/file-structure/production
91- run : terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
97+ run : |
98+ terraform init
99+ terraform apply -var db_pass=${{secrets.DB_PASS }} -auto-approve
You can’t perform that action at this time.
0 commit comments