Skip to content

Merge pull request #11 from Food-fusion-Fiap/fix-dir-lambda #11

Merge pull request #11 from Food-fusion-Fiap/fix-dir-lambda

Merge pull request #11 from Food-fusion-Fiap/fix-dir-lambda #11

Workflow file for this run

name: Deploy to AWS
on:
push:
branches:
- master
workflow_dispatch:
inputs:
confirm:
description: 'Type "yes" to confirm destroy action'
required: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
jobs:
terraform_apply:
name: 'Terraform Apply'
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.8.2
- name: Terraform Init
run: terraform init
- name: Terraform Plan
run: terraform plan
- name: Clone repository
run: |
git clone https://github.com/Food-fusion-Fiap/lambda-auth
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Install dependencies
run: npm install --production
working-directory: lambda-auth
- name: Build TypeScript
run: npm run build
working-directory: lambda-auth
- name: Create ZIP file
run: zip -r lambda_function.zip .
working-directory: lambda-auth
- name: Terraform Apply
run: terraform apply -auto-approve
terraform_destroy:
name: 'Terraform Destroy'
runs-on: ubuntu-latest
if: github.event_name == 'workflow_dispatch' && github.event.inputs.confirm == 'yes'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.8.2
- name: Terraform Init
run: terraform init
- name: Terraform Destroy
run: terraform destroy -auto-approve