workflow: Add deployment workflow leave app and server #2
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: Node.js CI | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
build: | |
runs-on: self-hosted | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "yarn" | |
- name: Install server Dependencies | |
run: | | |
cd server | |
yarn install --frozen-lockfile | |
- name: Install app Dependencies | |
run: | | |
cd client | |
yarn install --frozen-lockfile | |
- name: Build app | |
run: | | |
cd client | |
yarn build | |
- name: Start server | |
run: | | |
cd server | |
pm2 start server.js --name "server" --watch | |
- name: Start app | |
run: | | |
cd client | |
pm2 start npm --name "app" -- start |