Skip to content

Update main.yml

Update main.yml #896

Workflow file for this run

name: main
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4.1.1
- name: Setup Node
uses: actions/setup-node@v4.0.0
with:
node-version: '16'
- name: Install client dependencies
run: cd client && npm install && cd ..
- name: Install server dependencies
run: cd server && npm install && cd ..
- name: Build client
run: cd client && npm run build && cd ..
- name: Frontend Tests
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'master' || github.event_name == 'push' && github.ref == 'refs/heads/master' }}
run: cd client && npm run test && cd ..
- name: Deploy to Production
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/cicd_deploy' }}
uses: appleboy/ssh-action@v1.0.0
with:
key: ${{ secrets.SSH_KEY }}
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
script: |
cd neiist-website; git pull;
cd server; npm ci; cd ..;
cd client; npm ci; npm run build; exit;
sudo systemctl restart neiist_server.service;