-
Notifications
You must be signed in to change notification settings - Fork 1
149 lines (124 loc) · 4.38 KB
/
aliyun.yml
File metadata and controls
149 lines (124 loc) · 4.38 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: aliyun CI
on:
push: # push的时候触发
branches: # 那些分支需要触发
- main
jobs:
build:
runs-on: ubuntu-latest # 镜像市场
steps:
- name: checkout # 步骤的名称
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: clone git submodule
run: |
git submodule update --init --recursive
- name: 配置 search 搜索参数替换
uses: falnyr/replace-env-vars-action@master
env:
ALGOLIA_SEARCH_API_KEY: ${{ secrets.ALGOLIA_SEARCH_API_KEY }}
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
with:
filename: config.io/_default/params.zh-cn.toml
- name: 配置 comment 参数替换
uses: falnyr/replace-env-vars-action@master
env:
VALINE_ENABLE: ""
GITALK_ENABLE: true
GITALK_CLIENT_ID: ${{ secrets.GITALK_CLIENT_CN }}
GITALK_SECRET: ${{ secrets.GITALK_SECRET_CN }}
with:
filename: config.io/_default/params.toml
- name: 配置参数icp
uses: NicoG60/simple-template-renderer@v1
with:
input: config.io/_default/params.toml
env:
ICP: "<a href=https://beian.miit.gov.cn/ target=_blank>京ICP备16062974号-1</a>"
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.146.0'
extended: true # 启用 extended
- name: Build 主站
run: hugo --configDir config.io
- name: 打印目录结构
run: |
pwd
ls
- name: Build leetcode book
run: hugo --config book.leetcode.toml
- name: 复制 leetcode book 资源到 public
run: |
mkdir public/leetcode
cp -r public.book.leetcode/* public/leetcode
- name: Build wiki book
run: hugo --config book.wiki.toml
- name: 复制 wiki book 资源到 public
run: |
mkdir public/wiki
cp -r public.book.wiki/* public/wiki
- name: Build linux book
run: hugo --config book.linux.toml
- name: 复制 linux book 资源到 public
run: |
mkdir public/linux
cp -r public.book.linux/* public/linux
- name: Build english book
run: hugo --config=book.english.toml
- name: 复制 english book 资源到 public
run: |
mkdir public/english
cp -r public.book.english/* public/english
- name: Build kubernetes book
run: hugo --config book.kubernetes.toml
- name: 复制 kubernetes book 资源到 public
run: |
mkdir public/kubernetes
cp -r public.book.kubernetes/* public/kubernetes
# - name: Build ielts book
# run: hugo --config book.ielts.toml
#
# - name: 复制 ielts book 资源到 public
# run: |
# mkdir public/ielts
# cp -r public.book.ielts/* public/ielts
- name: Build http book
run: hugo --config book.http.toml
- name: 复制 http book 资源到 public
run: |
mkdir public/http
cp -r public.book.http/* public/http
- name: Build mrhh book
run: hugo --config book.mrhh.toml
- name: 复制 明日黄花 资源到 public
run: |
mkdir public/mrhh
cp -r public.book.mrhh/* public/mrhh
- name: 删除服务上的旧文件
uses: JimCronqvist/action-ssh@master
with:
hosts: '${{ secrets.ALIYUN_HOST }}'
privateKey: ${{ secrets.ALIYUN_PRIVATE_KEY }}
command: |
cd /usr/local/nginx/html/www.xiaobinqt.cn
pwd
rm -rf /usr/local/nginx/html/www.xiaobinqt.cn/*
#部署到服务器
- name: Deploy to aliyun server
uses: easingthemes/ssh-deploy@v2.1.6
env:
#私钥
SSH_PRIVATE_KEY: ${{ secrets.ALIYUN_PRIVATE_KEY }} #后面指定为该仓库配置的私钥
ARGS: "-rltgoDzvO"
# 源目录,编译后生成的文件目录
SOURCE: '/public/'
#服务器公网地址
REMOTE_HOST: '${{ secrets.ALIYUN_HOST }}'
#服务器用户名-一般默认root
REMOTE_USER: 'root'
#服务器中,代码部署的位置
TARGET: '/usr/local/nginx/html/www.xiaobinqt.cn/'
#去除的文件
# EXCLUDE: "/dist/, /node_modules/"