forked from paoloo/asi
-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (34 loc) · 1.15 KB
/
Copy pathcd.yml
File metadata and controls
42 lines (34 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
name: "Terraform GitHub Actions CD"
on:
push:
branches:
- staging
- master
jobs:
deploy:
name: Deploy Staging
runs-on: ubuntu-latest
env:
TF_ACTIONS_VERSION: 0.12.23
steps:
- name: "Check Workspace production"
if: github.ref == 'refs/heads/master'
run: echo "::set-env name=TF_WORKSPACE::production"
- name: "Check Workspace staging"
if: github.ref == 'refs/heads/staging'
run: echo "::set-env name=TF_WORKSPACE::staging"
- name: "Code Checkout"
uses: actions/checkout@v1
- name: "Terraform Init"
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: ${{ env.TF_ACTIONS_VERSION }}
tf_actions_subcommand: "init"
tf_actions_cli_credentials_token: ${{secrets.TERRAFORM_API_TOKEN}}
- name: "Terraform Apply"
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/staging'
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: ${{ env.TF_ACTIONS_VERSION }}
tf_actions_subcommand: "apply"
tf_actions_cli_credentials_token: ${{secrets.TERRAFORM_API_TOKEN}}