feat: 优化后端代码 #136
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: Deploy PityWeb | |
on: | |
push: | |
branches: | |
- master # 只在master上push触发部署 | |
paths-ignore: # 下列文件的变更不触发部署,可以自行添加 | |
- README.md | |
- LICENSE | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@master | |
- name: use Node.js 16 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
- name: npm install and build | |
run: | | |
npm install -f | |
npm run build | |
env: | |
CI: true | |
- name: copy file via ssh password | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
source: "dist/" | |
target: "/home/tester/pityWeb/" | |
- name: restart | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script: | | |
cd /home/tester/pityWeb | |
pm2 delete web | |
pm2 start web.sh | |