@@ -81,33 +81,39 @@ MultiDocumenter.make(
8181 rootpath = " /MultiDocumenter.jl/" ,
8282)
8383
84- gitroot = normpath (joinpath (@__DIR__ , " .." ))
85- run (` git pull` )
86- outbranch = " gh-pages"
87- has_outbranch = true
88- if ! success (` git checkout $outbranch ` )
89- has_outbranch = false
90- if ! success (` git switch --orphan $outbranch ` )
91- @error " Cannot create new orphaned branch $outbranch ."
92- exit (1 )
84+ if " deploy" in ARGS
85+ @warn " Deploying to GitHub" ARGS
86+ gitroot = normpath (joinpath (@__DIR__ , " .." ))
87+ run (` git pull` )
88+ outbranch = " gh-pages"
89+ has_outbranch = true
90+ if ! success (` git checkout $outbranch ` )
91+ has_outbranch = false
92+ if ! success (` git switch --orphan $outbranch ` )
93+ @error " Cannot create new orphaned branch $outbranch ."
94+ exit (1 )
95+ end
9396 end
94- end
95- for file in readdir (gitroot; join = true )
96- endswith (file, " .git" ) && continue
97- rm (file; force = true , recursive = true )
98- end
99- for file in readdir (outpath)
100- cp (joinpath (outpath, file), joinpath (gitroot, file))
101- end
102- run (` git add .` )
103- if success (` git commit -m 'Aggregate documentation'` )
104- @info " Pushing updated documentation."
105- if has_outbranch
106- run (` git push` )
97+ for file in readdir (gitroot; join = true )
98+ endswith (file, " .git" ) && continue
99+ rm (file; force = true , recursive = true )
100+ end
101+ for file in readdir (outpath)
102+ cp (joinpath (outpath, file), joinpath (gitroot, file))
103+ end
104+ run (` git add .` )
105+ if success (` git commit -m 'Aggregate documentation'` )
106+ @info " Pushing updated documentation."
107+ if has_outbranch
108+ run (` git push` )
109+ else
110+ run (` git push -u origin $outbranch ` )
111+ end
112+ run (` git checkout main` )
107113 else
108- run ( ` git push -u origin $outbranch ` )
114+ @info " No changes to aggregated documentation. "
109115 end
110- run (` git checkout main` )
111116else
112- @info " No changes to aggregated documentation."
117+ @info " Skipping deployment, 'deploy' not passed. Generated files in docs/out." ARGS
118+ cp (outpath, joinpath (@__DIR__ , " out" ), force = true )
113119end
0 commit comments