-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (41 loc) · 1.15 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: deploy note
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
#打包构建
- name: Use Node.js
uses: actions/setup-node@v1
- run: npm install
- run: npm run build
- run: mkdir temp
#压缩文件
- run: tar -zcvf ./temp/release.tgz .nuxt static nuxt.config.js package.json
#scp上传压缩包
- name: scp
uses: garygrossgarten/github-action-scp@release
with:
rmRemote: true
local: "temp"
password: ${{secrets.TOKEN}}
host: ${{ secrets.IP }}
username: ${{ secrets.USER }}
remote: "/usr/webapp/note" #
# 重启服务 pm2 start npm --name "blog" -- run start
- name: deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.IP }}
username: ${{ secrets.USER }}
password: ${{secrets.TOKEN}}
script: |
cd /usr/webapp/note
tar zxvf release.tgz
npm install --production
pm2 restart blog