Skip to content

Update README.md

Update README.md #21

Workflow file for this run

name: Build and deploy to remote server
on:
push:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
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: 'npm'
- name: Install the dependencies
run: npm install
- name: Build the app
run: |
npm run build:frontend
npm run build:backend
- name: Bundle the app
run: npm run bundle
- name: Upload artifacts
uses: actions/upload-artifact@master
with:
name: bundled-app
path: bundle
deploy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@master
with:
name: bundled-app
path: bundle
- name: Copy files via SSH
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
source: bundle/*
target: ${{ secrets.DEST_PATH }}
- name: Restart the app
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script: |
cd ${{ secrets.DEST_PATH }}/bundle
tar -c build server package.json -f artifact.tar
cd ..
npm install
tar -xf bundle/artifact.tar -C . --overwrite
rm -rf bundle
pm2 restart urfu-ui