forked from HerryLo/BlogPress
-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (65 loc) · 2.05 KB
/
main.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 to aliyun
on:
push:
branches:
- master
env:
SERVER_PRIVATE_KEY: ${{ secrets.ACCESS_TOKEN }} # 服务器私钥
SERVER_HOST: ${{ secrets.HOST }} # 服务器IP地址
USER_NAME: ${{ secrets.NAME }} # 服务器用户名
cache-name: blog
jobs:
build:
runs-on: ubuntu-latest
steps:
# 切换分支
- name: Checkout
uses: actions/checkout@master
- name: work around permission issue
run: git config --global --add safe.directory /github/workspace
# 使用 node:10
- name: use Node.js 14
uses: actions/setup-node@v1
with:
node-version: 14
#缓存依赖
- name: Cache nodemodules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
# 需要缓存的文件的路径
path: ./node_modules
# 对缓存的文件指定的唯一标识
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('./package.json') }}
# 用于没有再找目标key的缓存的backup选项
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# npm install
- name: npm install and build
run: |
npm install
npm run build
env:
CI: true
# Deploy
- name: Deploy to Server
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.ACCESS_TOKEN }}
ARGS: "-avz --delete"
SOURCE: "./docs/.vuepress/dist/"
REMOTE_HOST: ${{ secrets.HOST }}
REMOTE_USER: ${{ secrets.NAME }}
TARGET: "/www/blog2222"
# - name: Deploy aliyun
# uses: easingthemes/[email protected]
# env:
# SSH_PRIVATE_KEY: ${{ env.SERVER_PRIVATE_KEY }}
# ARGS: "-avz --delete"
# SOURCE: "./docs/.vuepress/dist/"
# REMOTE_HOST: ${{ env.SERVER_HOST }}
# REMOTE_USER: ${{ env.USER_NAME }}
# TARGET: "/www/blog2222"