-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aee79c3
commit 0de212c
Showing
6 changed files
with
137 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,26 @@ | ||
using Documenter | ||
using MultiDocumenter | ||
|
||
temp_dir = mktempdir() | ||
|
||
|
||
docs = [ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(temp_dir, "QUBO.jl"), | ||
path = "QUBO.jl", | ||
name = "QUBO.jl", | ||
giturl = "https://github.com/psrenergy/QUBO.jl.git", | ||
branch ="gh-pages" | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(temp_dir, "ToQUBO.jl"), | ||
path = "ToQUBO.jl", | ||
name = "ToQUBO.jl", | ||
giturl = "https://github.com/psrenergy/ToQUBO.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(temp_dir, "QUBODrivers.jl"), | ||
path = "QUBODrivers.jl", | ||
name = "QUBODrivers.jl", | ||
giturl = "https://github.com/psrenergy/QUBODrivers.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(temp_dir, "QUBOTools.jl"), | ||
path = "QUBOTools.jl", | ||
name = "QUBOTools.jl", | ||
giturl = "https://github.com/psrenergy/QUBOTools.jl.git", | ||
makedocs(; | ||
doctest=true, | ||
clean=true, | ||
format=Documenter.HTML( | ||
assets=[ | ||
"assets/extra_styles.css", | ||
# "assets/favicon.ico", | ||
], | ||
mathengine=Documenter.KaTeX(), | ||
sidebar_sitename=false, | ||
), | ||
|
||
] | ||
|
||
outpath = mktempdir() | ||
|
||
|
||
MultiDocumenter.make( | ||
outpath, | ||
docs; | ||
search_engine = MultiDocumenter.SearchConfig( | ||
index_versions = ["stable"], | ||
engine = MultiDocumenter.FlexSearch | ||
), | ||
rootpath = "/QUBO.jl", | ||
sitename="QUBO.jl", | ||
authors="Pedro Xavier and Pedro Ripper and Tiago Andrade and Joaquim Garcia and David Bernal", | ||
pages=[ | ||
"Home" => "index.md" | ||
], | ||
workdir="." | ||
) | ||
|
||
gitroot = normpath(joinpath(@__DIR__, "..")) | ||
run(`git pull`) | ||
outbranch = "gh-multi-pages" | ||
has_outbranch = true | ||
if !success(`git checkout $outbranch`) | ||
has_outbranch = false | ||
if !success(`git checkout -b $outbranch`) | ||
@error "Cannot create new orphaned branch $outbranch." | ||
exit(1) | ||
end | ||
end | ||
|
||
for file in readdir(gitroot; join = true) | ||
endswith(file, ".git") && continue | ||
rm(file; force = true, recursive = true) | ||
end | ||
for file in readdir(outpath) | ||
cp(joinpath(outpath, file), joinpath(gitroot, file)) | ||
end | ||
run(`git add .`) | ||
if success(`git commit -m 'Aggregate documentation'`) | ||
@info "Pushing updated documentation." | ||
if has_outbranch | ||
run(`git push`) | ||
else | ||
run(`git push -u origin $outbranch`) | ||
end | ||
run(`git checkout master`) | ||
if "--skip-deploy" ∈ ARGS | ||
@warn "Skipping deployment" | ||
else | ||
@info "No changes to aggregated documentation." | ||
deploydocs(raw"github.com/psrenergy/QUBO.jl.git", push_preview=true) | ||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
using Documenter | ||
using MultiDocumenter | ||
|
||
temp_dir = mktempdir() | ||
|
||
docs = [ | ||
MultiDocumenter.MultiDocRef( | ||
upstream=joinpath(temp_dir, "QUBO.jl"), | ||
path="QUBO.jl", | ||
name="QUBO.jl", | ||
giturl="https://github.com/psrenergy/QUBO.jl.git", | ||
branch="gh-pages", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream=joinpath(temp_dir, "ToQUBO.jl"), | ||
path="ToQUBO.jl", | ||
name="ToQUBO.jl", | ||
giturl="https://github.com/psrenergy/ToQUBO.jl.git", | ||
branch="gh-pages", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream=joinpath(temp_dir, "QUBODrivers.jl"), | ||
path="QUBODrivers.jl", | ||
name="QUBODrivers.jl", | ||
giturl="https://github.com/psrenergy/QUBODrivers.jl.git", | ||
branch="gh-pages", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream=joinpath(temp_dir, "QUBOTools.jl"), | ||
path="QUBOTools.jl", | ||
name="QUBOTools.jl", | ||
giturl="https://github.com/psrenergy/QUBOTools.jl.git", | ||
branch="gh-pages", | ||
), | ||
] | ||
|
||
function buildmultidocs(path::AbstractString, docs) | ||
MultiDocumenter.make( | ||
path, | ||
docs; | ||
search_engine=MultiDocumenter.SearchConfig( | ||
index_versions=["stable"], | ||
engine=MultiDocumenter.FlexSearch | ||
), | ||
rootpath="/QUBO.jl" | ||
) | ||
|
||
return nothing | ||
end | ||
|
||
function deploymultidocs(path::AbstractString; branch::String="gh-multi-pages", main::String="main") | ||
root_path = normpath(joinpath(@__DIR__, "..")) | ||
|
||
run(`git pull`) | ||
|
||
has_branch = true | ||
|
||
if !success(`git checkout $branch`) | ||
has_branch = false | ||
if !success(`git checkout -b $branch`) | ||
@error "Cannot create new orphaned branch $branch" | ||
exit(1) | ||
end | ||
end | ||
|
||
for file in readdir(root_path; join=true) | ||
endswith(file, ".git") && continue | ||
rm(file; force=true, recursive=true) | ||
end | ||
|
||
for file in readdir(path) | ||
cp(joinpath(path, file), joinpath(root_path, file)) | ||
end | ||
|
||
run(`git add .`) | ||
|
||
if success(`git commit -m 'Aggregate documentation'`) | ||
@info "Pushing updated documentation" | ||
|
||
if has_branch | ||
run(`git push`) | ||
else | ||
run(`git push -u origin $branch`) | ||
end | ||
|
||
run(`git checkout $main`) | ||
else | ||
@info "No changes to aggregated documentation" | ||
end | ||
|
||
return nothing | ||
end | ||
|
||
# creates if not exists | ||
build_path = mkpath(joinpath(@__DIR__, "build_path")) | ||
|
||
buildmultidocs(build_path, docs) | ||
|
||
if "--skip-deploy" ∈ ARGS | ||
@warn "Skipping deployment" | ||
else | ||
deploymultidocs(build_path; main="master") | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters