-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (48 loc) · 1.71 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
name: DeployDocs
on:
push: # 监听调用时机为push事件
branches: [main]
jobs:
build:
runs-on: ubuntu-latest # runs-on 指定job任务运行所需要的虚拟机环境(必填字段)
steps:
- name: 拉取代码 # 步骤名字
uses: actions/checkout@master # 使用 actions/checkout 库拉取最新源码
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
cache: pnpm
- name: 项目安装依赖
run: pnpm install --no-frozen-lockfile
- name: 项目打包构建
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |
pnpm build && pnpm docs:build
- name: 部署产物到服务器
uses: appleboy/scp-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
source: packages/docs/.vitepress/dist/
target: '/${{secrets.SSH_USERNAME}}/Projects/.vitepress-theme-mild_temp/'
rm: true
strip_components: 4
- name: 执行远程脚本命令
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
mkdir -p ~/Projects/vitepress-theme-mild
rm -rf ~/Projects/vitepress-theme-mild/*
cp -rf ~/Projects/.vitepress-theme-mild_temp/* ~/Projects/vitepress-theme-mild/
rm -rf ~/Projects/.vitepress-theme-mild_temp
- run: echo "部署完成!"