forked from microsoft/AirSim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_docs.bat
69 lines (58 loc) · 1.66 KB
/
build_docs.bat
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
@echo off
REM //---------- set up variable ----------
setlocal
set ROOT_DIR=%~dp0
pushd %~dp0
set BUILD_DIR=%ROOT_DIR%temp\docs_build
rem mdir /s /q %BUILD_DIR%
robocopy "docs" "%BUILD_DIR%\doc_root\docs" /MIR /njh /njs /ndl /np /nfl /r:0
robocopy "." "%BUILD_DIR%\doc_root" *.md /njh /njs /ndl /np /nfl /r:0
robocopy "%BUILD_DIR%\doc_root\docs" "%BUILD_DIR%" mkdocs.yml /MOV /njh /njs /ndl /np /nfl /r:0
REM Copy of all folders is no needed as we use absolute URLs now
REM for /d %%x in (
REM "%ROOT_DIR%*"
REM ) do (
REM cd /d "%BUILD_DIR%\doc_root"
REM IF "%%~nx"=="" (
REM REM Do nothing
REM ) ELSE (
REM IF NOT EXIST "%%~nx" mklink /D "%%~nx" "%ROOT_DIR%%%~nx"
REM )
REM )
cd /d %BUILD_DIR%
if "%1"=="no_serve" goto PromptYN
mkdocs serve
:PromptYN
REM if exist "%SystemRoot%\System32\choice.exe" goto UseChoice
setlocal EnableExtensions EnableDelayedExpansion
:UseSetPrompt
set "PromptMessage=Do you want to commit to GitHub Pages [Y/N]? "
set "UserChoice=N"
set /P "UserChoice=%PromptMessage%"
set "UserChoice=!UserChoice: =!"
if /I "!UserChoice!" == "N" endlocal & goto :AnswerNo
if /I not "!UserChoice!" == "Y" goto UseSetPrompt
endlocal
goto AnswerYes
REM :UseChoice
REM %SystemRoot%\System32\choice.exe /C YN /N /M "%PromptMessage%"
REM if errorlevel 2 goto :AnswerNo
REM goto AnswerYes
:AnswerYes
@echo Building and commiting to gh-pages branch...
mkdocs build
git checkout gh-pages
cd /d %BUILD_DIR%
REM robocopy "docs" "%BUILD_DIR%\build" /MIR /njh /njs /ndl /np /nfl /r:0
goto success
:AnswerNo
@echo No commits were done.
goto success
:success
@echo "Task completed."
goto end
:failed
@echo "Task has failed."
goto end
:end
popd