Skip to content

Deploy static content to Pages #2

Deploy static content to Pages

Deploy static content to Pages #2

name: Build and deploy Node.js app
on:
push:
branches:
- main
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js version
uses: actions/setup-node@v3
with:
node-version: "18.x"
- name: build server
working-directory: ./server
run: |
npm install
npm run build --if-present
- name: build client
working-directory: ./client
run: |
npm install
npm run build:web --if-present
- name: Upload artifact for deployment job
uses: actions/upload-artifact@v3
with:
name: node-app
path: |
server/.build
server/dist
server/index.js
deploy:
runs-on: ubuntu-latest
needs: build
# environment:
# name: "Production"
# url: TODO
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
steps:
- name: Download artifact from build job
uses: actions/download-artifact@v3
with:
name: node-app
- run: npm i serverless@3.38.0
- run: ./.node_modules/.bin/serverless deploy