Deploy static content to Pages #2
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: 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 |