Skip to content

Merge pull request #41 from Instituto-Maua-de-Tecnologia/dev #231

Merge pull request #41 from Instituto-Maua-de-Tecnologia/dev

Merge pull request #41 from Instituto-Maua-de-Tecnologia/dev #231

Workflow file for this run

name: CD
on:
push:
branches:
- dev
- prod
jobs:
Deploy_to_AWS:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: '20.x'
- name: Install CDK dependencies
run: |
echo "Installing CDK dependencies"
npm install -g aws-cdk
npm install -g ts-node
npm install
cd iac
npm install
- name: Populate DB
run: |
echo "Populating DB"
npm run populate-db
env:
STAGE: ${{ github.ref_name }}
RDS_HOSTNAME: ${{ secrets.RDS_HOSTNAME }}
RDS_USERNAME: ${{ secrets.RDS_USERNAME }}
RDS_PASSWORD: ${{ secrets.RDS_PASSWORD }}
RDS_PORT: ${{ secrets.RDS_PORT }}
RDS_DB_NAME: ${{ secrets.RDS_DB_NAME }}
RDS_DIALECT: ${{ secrets.RDS_DIALECT }}
- name: AWS Credentials
run: |
echo "Configuring AWS Credentials"
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region ${{ secrets.AWS_REGION }}
aws configure set default.output json
- name: CDK Bootstrap
run: |
echo "CDK Bootstrap"
cd iac
aws cloudformation describe-stacks --stack-name CDKToolkit 2>&1 > /dev/null || \
cdk bootstrap aws://${{ secrets.AWS_ACCOUNT_ID }}/${{ secrets.AWS_REGION }}
- name: CDK Deploy
run: |
echo "CDK Deploy"
cd iac
cdk deploy --require-approval never
env:
STAGE: ${{ github.ref_name }}
AZURE_URL: ${{ secrets.AZURE_URL }}
SECRET_KEY: ${{ secrets.SECRET_KEY }}
RDS_HOSTNAME: ${{ secrets.RDS_HOSTNAME }}
RDS_USERNAME: ${{ secrets.RDS_USERNAME }}
RDS_PASSWORD: ${{ secrets.RDS_PASSWORD }}
RDS_PORT: ${{ secrets.RDS_PORT }}
RDS_DB_NAME: ${{ secrets.RDS_DB_NAME }}
RDS_DIALECT: ${{ secrets.RDS_DIALECT }}
AWS_REGION: ${{ secrets.AWS_REGION }}
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}