-
Notifications
You must be signed in to change notification settings - Fork 135
/
Copy pathdocPublish.xml
93 lines (53 loc) · 2.89 KB
/
docPublish.xml
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
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--配置参数-->
<WorkDir>C:\projects\aspnetcore-doc-cn\</WorkDir>
<webDir>C:\website\aspnetcore-doc-cn\</webDir>
<webName>dotnetcore.github.io</webName>
<domainName>aspnet.docs.dotnet-china.org</domainName>
<baiduCode>Bh1NXh3smd</baiduCode>
<webrepUrl>https://github.com/dotnetcore/dotnetcore.github.io</webrepUrl>
<docfxPath>"$(WorkDir)aspnetcore\docfx.json"</docfxPath>
<templatePath>"$(WorkDir)_exported_templates\default"</templatePath>
<sitePath>"$(WorkDir)aspnetcore\_site"</sitePath>
<sourcePath>$(WorkDir)aspnetcore</sourcePath>
<pubsitePath>"$(webDir)$(webName)"</pubsitePath>
<pdfresourcePath>"$(WorkDir)\pdfresource"</pdfresourcePath>
<SubDirName>aspnetcoredoccn</SubDirName>
<ProjectDir>$(webDir)$(webName)\$(SubDirName)\</ProjectDir>
</PropertyGroup>
<Target Name="build">
<CallTarget Targets="buildwebsite"/>
<CallTarget Targets="buildPdf"/>
<CallTarget Targets="pubish2githubIo"/>
</Target>
<!--生成网站-->
<Target Name="buildwebsite">
<Message Text="Start to build website"></Message>
<Exec Command="docfx build $(docfxPath) -t $(templatePath) " WorkingDirectory="$(WorkDir)" ></Exec>
<Message Text="Build website successfully."></Message>
<Message Text="Start to fix website files"></Message>
<Exec Command="FixSite.exe $(sitePath) "></Exec>
<Message Text="Fix website files"></Message>
</Target>
<!--发布网站到githubio-->
<Target Name="pubish2githubIo">
<Exec Command="git clone --progress $(webrepUrl) " WorkingDirectory="$(webDir)" />
<!-- <Exec Command="git rm * -r" WorkingDirectory="$(webDir)$(webName)" ></Exec> -->
<RemoveDir Directories="$(ProjectDir)" />
<MakeDir Directories="$(ProjectDir)"/>
<Delete Files="$(ProjectDir)" />
<Exec Command="xcopy.exe $(sitePath) $(ProjectDir) /e" />
<!-- <Exec Command="echo $(domainName) > CNAME" WorkingDirectory="$(webDir)$(webName)" ></Exec>
<Exec Command="echo $(baiduCode) > baidu_verify_Bh1NXh3smd.html" WorkingDirectory="$(webDir)$(webName)" ></Exec> -->
<Exec Command="git add -A" WorkingDirectory="$(webDir)$(webName)" ></Exec>
<Exec Command="git commit -m "submit new website"" WorkingDirectory="$(webDir)$(webName)" ></Exec>
<Exec Command="git push --progress -u origin master " WorkingDirectory="$(webDir)$(webName)" ></Exec>
</Target>
<Target Name="buildPdf">
<Exec Command="xcopy.exe $(pdfresourcePath) $(sourcePath) /e /s" />
<Exec Command="docfx.exe pdf docfxpdf.json" WorkingDirectory="$(sourcePath)" />
<Exec Command="move $(sourcePath)\_site-pdf\aspnetcore.pdf $(sourcePath)\_site\aspnet_core_doc_cn.pdf"/>
</Target>
</Project>