Release v2.1.1 #417
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: CI/CD | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Use Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' | |
- name: Install dependencies | |
run: npm ci | |
- name: Unit tests | |
run: npm run test | |
- name: ESLint check | |
run: npm run lint | |
- name: Build | |
run: npm run build | |
deploy: | |
if: github.event_name == 'push' | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to server | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
port: ${{ secrets.SERVER_PORT }} | |
script: | | |
export NVM_DIR=~/.nvm | |
source ~/.nvm/nvm.sh | |
npm --help | |
cd scholarx-frontend | |
git pull | |
npm install | |
npm run build | |
echo "build successful" | |
sudo cp -r dist/* /var/www/scholarx/ | |
sudo systemctl restart nginx |