NOBUG - Allowing manual deploy of dev. #156
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |