-
Notifications
You must be signed in to change notification settings - Fork 71
56 lines (54 loc) · 1.54 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
45
46
47
48
49
50
51
52
53
54
55
56
name: Deploy
on:
# 推送时执行
push:
branches: [dev]
# 可手动执行
workflow_dispatch:
jobs:
deploy-web:
runs-on: ubuntu-latest
steps:
# 1、检出源码
- name: Checkout
uses: actions/checkout@master
# 2、安装 PNPM
- name: Setup PNPM
uses: pnpm/action-setup@v2
with:
version: latest
# 3、安装 Node 环境
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm
cache-dependency-path: ./pnpm-lock.yaml
# 4、安装依赖
- name: Install Dependencies
run: pnpm i --frozen-lockfile
# 5、打包
- name: Build
run: pnpm build
# 6、拷贝到服务器
- name: Copy
uses: garygrossgarten/github-action-scp@release
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
local: ./dist
remote: /docker/continew-admin/tmp
# 7、重启 Nginx
- name: Restart
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_HOST }}
port: ${{ secrets.SERVER_PORT }}
username: ${{ secrets.SERVER_USERNAME }}
password: ${{ secrets.SERVER_PASSWORD }}
script: |
rm -rf /docker/continew-admin/html/*
mv /docker/continew-admin/tmp/* /docker/continew-admin/html
docker restart nginx