Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Deploy to AWS

Deploy to AWS #73

Workflow file for this run

---
name: Deploy to AWS
on:
workflow_run:
workflows:
- build
branches:
- develop
- production
- staging
types:
- completed
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_REGION: ${{ vars.TF_BACKEND_AWS_REGION }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEPLOY_ENVIRONMENT: ${{ github.ref_name }}
DEPLOY_TF_BACKEND_ROLE_ARN: ${{ secrets.TF_BACKEND_ROLE_ARN }}
DEPLOY_TF_BUCKET: ${{ secrets.TF_BACKEND_BUCKET }}
DEPLOY_TF_DYNAMODB: ${{ secrets.TF_BACKEND_DYNAMODB }}
DEPLOY_ROLE_ARN: ${{ secrets.AWS_DEPLOY_ROLE_ARN }}
DEPLOY_ROUTE53_ZONE_ID: ${{ secrets.ROUTE53_ZONE_ID }}
DEPLOY_TF_VARS_URL: ${{ vars.TF_VARS_URL }}
tf_version: 'latest'
tf_working_dir: './deploy'
tg_version: 'latest'
permissions:
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment: ${{ github.ref_name }}
steps:
- name: Check GitHub Status
uses: crazy-max/ghaction-github-status@f947abedefc0d01e4bae344bd7061897ae4e6de9
with:
overall_threshold: major
packages_threshold: major_outage
- name: Dump context
uses: crazy-max/ghaction-dump-context@8b55fa205ab4530d36f787a4de1009afaaa7f3b4
- name: Dump vars context
env:
VARS_JSON: ${{ toJSON(vars) }}
run: echo "${VARS_JSON}"
- name: Checkout
uses: actions/checkout@v4
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Terragrunt apply
uses: the-commons-project/terragrunt-github-actions@master
with:
tf_actions_binary: "terragrunt run-all"
tf_actions_version: ${{ env.tf_version }}
tg_actions_version: ${{ env.tg_version }}
tf_actions_subcommand: "apply"
tf_actions_working_dir: ${{ env.tf_working_dir }}
tf_actions_comment: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TF_INPUT: false