Skip to content

fix: break down deploy workflow into separate steps #3

fix: break down deploy workflow into separate steps

fix: break down deploy workflow into separate steps #3

Workflow file for this run

name: Deploy to AWS
on:
push:
branches:
- cloud/aws
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "18" # Use the version that matches your project
- name: Install pnpm
run: npm install -g pnpm
- name: Build frontend & backend
run: pnpm run build
- name: Package backend
run: |
cd backend/build
zip -r ../../backend.zip ./*
deploy:
runs-on: ubuntu-latest
needs: build # Ensure deploy runs after build completes
steps:
- name: Deploy to S3
run: |
aws s3 sync frontend/dist s3://$S3_BUCKET --delete
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
- name: Update Lambda Function
run: |
aws lambda update-function-code --function-name $LAMBDA_FUNCTION_NAME --zip-file fileb://backend.zip
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}