-
Notifications
You must be signed in to change notification settings - Fork 21
/
appveyor.yml
72 lines (70 loc) · 3.3 KB
/
appveyor.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
66
67
68
69
70
71
72
image: Visual Studio 2017 # 镜像,也就是所依赖的环境
clone_folder: c:\projects\xdoc # 克隆下来的位置
environment: # 环境变量,在这里声明,下面使用
op_build_user: "xxred"
op_build_user_email: "[email protected]"
access_token:
secure: bCtIcPHYlrOYLppEVAH8R4VZpAWou5dKlDhbEPyXfgmI9wEMvH4MD0fFXYrv5sLS
init: # 初始化
- git config --global core.autocrlf false # 禁止自动完成标准化与转换(CRLF 与 LF 自动转换)
- ps: |
write-host $env:APPVEYOR_ACCOUNT_NAME
write-host $env:APPVEYOR_PROJECT_NAME
# write-host "https://$env:APPVEYOR_ACCOUNT_NAME.github.io/$env:APPVEYOR_PROJECT_NAME/"
install: #
# 以下通过choco安装docfx
- ps: |
if(-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
{
git checkout $env:APPVEYOR_REPO_BRANCH -q
# choco install docfx -y
# choco install nuget.commandline -y
}
- ps: |
write-host '准备安装vuepress'
npm install -g [email protected]
write-host '安装完成vuepress'
build_script: # 构建生成
- ps: |
if(-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
{
#-----------利用docfx命令生成html-----------------------------------------------------start
#& nuget install docfx.console -Version 2.36.2 # -Source https://www.myget.org/F/docfx/api/v3/index.json
#& docfx.console.2.36.2\tools\docfx.exe docfx.json
# & docfx docfx.json
#if ($lastexitcode -ne 0){
# throw [System.Exception] "docfx build failed with exit code $lastexitcode."
#}
#-----------利用docfx命令生成html-------------------------------------------------------end
}
- ps: |
write-host '开始构建 '
npm run build
# vuepress build articles
write-host '结束构建 '
test_script:
- ps: |
node -v
vuepress -V
on_success: # 成功构建之后部署
# 以下就是配置git账号和token,将最终生成的html部署(提交)到你的站点(仓库),
- ps: |
if(-Not $env:APPVEYOR_PULL_REQUEST_TITLE)
{
#-----------配置git账号信息,使用到的就是上面的环境变量----------------------------------start
git config --global credential.helper store
Add-Content "$env:USERPROFILE\.git-credentials" "https://$($env:access_token):[email protected]`n"
git config --global user.email $env:op_build_user_email
git config --global user.name $env:op_build_user
#-----------配置git账号信息,使用到的就是上面的环境变量------------------------------------end
#-----------这里就是部署的地方,克隆你项目的pages分支,复制生成的html然后提交--------------start
git clone https://github.com/newlifex/newlifex.github.io.git -b master origin_site -q
rm origin_site/* -recurse
Copy-Item origin_site/.git vuepress -recurse
CD vuepress
git add -A 2>&1
git commit -m "CI Updates" -q
git push origin master -q
write-host '发布成功'
#-----------这里就是部署的地方,克隆你项目的pages分支,复制生成的html然后提交----------------end
}