-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (58 loc) · 1.62 KB
/
github-action.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
57
58
59
60
61
62
63
64
65
name: Deploy blog
# 监听 master 分支上的 push 事件
on:
push:
branches:
- master
jobs:
build-and-deploy:
# 构建环境使用 ubuntu
runs-on: ubuntu-latest
steps:
# 官方action, 将代码拉取到虚拟机
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
# 安装node.js
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "16.15.1"
# 下载依赖、打包项目
- name: Install and Build
run: |
yarn install
yarn docs:build
# 编译后的文件上传新分支
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
TOKEN: ${{ secrets.ACCESS_TOKEN }}
BRANCH: blog
FOLDER: src/.vuepress/dist
deploy-server:
runs-on: ubuntu-latest
needs: build-and-deploy
steps:
- name: Checkout Blog
uses: actions/checkout@v3
with:
ref: blog
fetch-depth: 0
# 部署到服务器
- name: Upload to Deploy Server
uses: appleboy/scp-action@master
with:
# 服务器域名
host: ${{ secrets.SERVER_HOST }}
# 服务器用户名
username: ${{ secrets.SERVER_USERNAME }}
# 服务器密码
password: ${{ secrets.SERVER_PASSWORD }}
# 指定上传的文件目录(项目配置的打包目录名称)
source: './*'
# 指定上传服务器目录
target: '/www/wwwroot/yaien'
# 解压时覆盖现有文件
overwrite: true