-
Notifications
You must be signed in to change notification settings - Fork 11
78 lines (67 loc) · 2.05 KB
/
deploy_dev.yaml
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Deploy Dev
on:
push:
branches: [main]
workflow_dispatch:
env:
TF_VERSION: 0.14.7
TG_VERSION: 0.37.1
TG_SRC_PATH: terraform
TFC_WORKSPACE: dev
TARGET_ENV: dev
GIT_BRANCH: main
permissions:
id-token: write
contents: read
jobs:
ci:
name: Build and Deploy
runs-on: ubuntu-latest
environment: dev
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@v3
### Install if no cache exists ###
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "yarn"
- run: yarn install --silent --frozen-lockfile
### Build if no cache exists ###
- name: Cache Build
id: cache-build
uses: actions/cache@v3
with:
path: |
**/terraform/src/artifacts
key: ${{ github.sha }}-artifacts
- name: Run Build
if: steps.cache-build.outputs.cache-hit != 'true'
run: yarn build-ci
### Get environment variables from AWS Parameter Store ###
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-region: ${{ secrets.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN_TO_USE }}
role-duration-seconds: 900
role-session-name: parks-ar-api-sandbox-dev-action
role-skip-session-tagging: true
### Run Terragrunt ###
- name: Setup terraform
uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.TF_VERSION }}
- name: Setup Terragrunt
uses: autero1/action-terragrunt@v1.3.0
with:
terragrunt_version: ${{ env.TG_VERSION }}
- name: Terragrunt Apply
working-directory: ${{ env.TG_SRC_PATH }}/${{ env.TARGET_ENV }}
env:
aws_region: ${{ secrets.AWS_REGION }}
run: terragrunt apply -auto-approve --terragrunt-non-interactive -var target_aws_account_id=${{ vars.ACCOUNT_ID }} -var target_env=dev