fix: add additional step for node_modules #10
Workflow file for this run
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 to AWS | |
on: | |
push: | |
branches: | |
- cloud/aws | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: Build | |
run: pnpm run build | |
- name: Package backend | |
run: | | |
cd backend/build | |
zip -r ../../backend.zip ./* ../../package.json ../../pnpm-lock.yaml | |
- name: Create Layer for Node Modules | |
run: | | |
mkdir -p layer/nodejs | |
cp -r backend/node_modules layer/nodejs/ | |
cd layer | |
zip -r layer.zip nodejs | |
- name: Deploy to S3 | |
run: | | |
aws s3 sync frontend/dist s3://${{ secrets.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 ${{ secrets.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 }} |