-
Notifications
You must be signed in to change notification settings - Fork 17
Use MultiDocumenter.jl #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 29 commits
eb24cc1
7459aed
ef85786
e1ffaca
d03a0f4
2c6cdd7
c627f09
4e402bd
0f6b853
c7f4072
777694d
d90ac6f
2efcffe
89b6c34
b6c6915
44338f2
430b814
39fd960
d562e7b
07daec8
8a9eefc
fefd672
24f81f3
7043e22
5be9729
98cbe98
f197c0e
0e830bd
fcd3307
18fc0d7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,15 +7,24 @@ on: | |
- cron: '15 2 * * *' # 2:15 AM UTC every day | ||
jobs: | ||
docs: | ||
name: Documentation | ||
name: MultiDocumentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: julia-actions/setup-julia@v2 | ||
with: | ||
version: "1" | ||
- uses: julia-actions/cache@v2 | ||
- uses: julia-actions/julia-docdeploy@v1 | ||
- name: Install dependencies | ||
shell: julia --color=yes --project=docs {0} | ||
run: | | ||
using Pkg | ||
Pkg.instantiate() | ||
- name: Aggregate and deploy | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
julia --color=yes --project=docs docs/make.jl --deploy | ||
env: | ||
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
using LibGit2, Pkg, TOML, UUIDs | ||
using MultiDocumenter, Documenter | ||
using LibGit2, Pkg, TOML, UUIDs, Downloads | ||
|
||
# This make file compiles the documentation for the JuliaAstro website. | ||
# It consists of the usual documeter structure, but also follows the approach | ||
# It consists of the usual documenter structure, but also follows the approach | ||
# of the SciML docs page https://github.com/SciML/SciMLDocs/blob/main/docs/make.jl | ||
# by generating nested documentation for packages under the JuliaAstro organization. | ||
# That way, docs for all packages are browesable and searchable in one place! | ||
# That way, docs for all packages are browsable and searchable in one place! | ||
|
||
include("install.jl") | ||
clonedir = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "clones") | ||
outpath = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "build") | ||
|
||
for depe in to_use | ||
eval(quote | ||
using $depe | ||
push!(allmods, $depe) | ||
end) | ||
end | ||
@info """ | ||
Cloning packages into: $(clonedir) | ||
Building aggregate site into: $(outpath) | ||
""" | ||
|
||
# We wait to import Documenter in case one of the packages requires | ||
# an older version. If that was the case, it's version may have changed | ||
# after the above for-loop | ||
using Documenter | ||
@info "Building MultiDocumenter site for JuliaAstro" | ||
|
||
include("pages.jl") | ||
mathengine = MathJax3(Dict( | ||
:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]), | ||
:tex => Dict( | ||
|
@@ -31,25 +29,285 @@ mathengine = MathJax3(Dict( | |
makedocs( | ||
sitename="JuliaAstro", | ||
authors = "Julia Astro Contributors", | ||
modules=identity.(allmods), | ||
clean=true, | ||
doctest=false, | ||
format=Documenter.HTML( | ||
mathengine=mathengine, | ||
prettyurls = get(ENV, "CI", "false") == "true", | ||
canonical = "https://juliaastro.github.io/", | ||
canonical = "https://juliaastro.org/", | ||
assets = String[ | ||
"assets/styles.css", | ||
"assets/favicon.ico", | ||
], | ||
), | ||
pages=fullpages, | ||
warnonly=[:missing_docs], | ||
) | ||
|
||
@info "Building aggregate JuliaAstro site" | ||
docs = [ | ||
# We also add JuliaAstro's own generated pages | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(@__DIR__, "build"), | ||
path = "docs", | ||
name = "JuliaAstro", | ||
fix_canonical_url = false, | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Time, Coordinates, & Units", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "AstroAngles"), | ||
path = "AstroAngles", | ||
name = "AstroAngles", | ||
giturl = "https://github.com/JuliaAstro/AstroAngles.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "AstroTime"), | ||
path = "AstroTime", | ||
name = "AstroTime", | ||
giturl = "https://github.com/JuliaAstro/AstroTime.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "ERFA"), | ||
path = "ERFA", | ||
name = "ERFA", | ||
giturl = "https://github.com/JuliaAstro/ERFA.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "SkyCoords"), | ||
path = "SkyCoords", | ||
name = "SkyCoords", | ||
giturl = "https://github.com/JuliaAstro/SkyCoords.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "UnitfulAstro"), | ||
path = "UnitfulAstro", | ||
name = "UnitfulAstro", | ||
giturl = "https://github.com/JuliaAstro/UnitfulAstro.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "WCS"), | ||
path = "WCS", | ||
name = "WCS", | ||
giturl = "https://github.com/JuliaAstro/WCS.jl.git", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Images", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "AstroImages"), | ||
path = "AstroImages", | ||
name = "AstroImages", | ||
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "SAOImagesDS9"), | ||
path = "SAOImagesDS9", | ||
name = "SAOImagesDS9", | ||
giturl = "https://github.com/JuliaAstro/SAOImageDS9.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "Photometry"), | ||
path = "Photometry", | ||
name = "Photometry", | ||
giturl = "https://github.com/juliaastro/Photometry.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "PSFModels"), | ||
path = "PSFModels", | ||
name = "PSFModels", | ||
giturl = "https://github.com/juliaastro/PSFModels.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "LACosmic"), | ||
path = "LACosmic", | ||
name = "LACosmic", | ||
giturl = "https://github.com/juliaastro/LACosmic.jl.git", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Data I/O", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "AstroImages"), | ||
path = "AstroImages", | ||
name = "AstroImages", | ||
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "FITSIO"), | ||
path = "FITSIO", | ||
name = "FITSIO", | ||
giturl = "https://github.com/JuliaAstro/FITSIO.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "CFITSIO"), | ||
path = "CFITSIO", | ||
name = "CFITSIO", | ||
giturl = "https://github.com/JuliaAstro/CFITSIO.jl.git", | ||
), | ||
MultiDocumenter.Link( | ||
"mweastwood/CasaCore", | ||
"http://mweastwood.info/CasaCore.jl/stable/", | ||
), | ||
MultiDocumenter.Link( | ||
"emmt/OIFITS", | ||
"https://github.com/emmt/OIFITS.jl", | ||
), | ||
MultiDocumenter.Link( | ||
"aplavin/VLBIData", | ||
"https://github.com/JuliaAPlavin/VLBIData.jl", | ||
), | ||
MultiDocumenter.Link( | ||
"aplavin/Difmap", | ||
"https://github.com/JuliaAPlavin/Difmap.jl", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Cosmology", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "Cosmology"), | ||
path = "Cosmology", | ||
name = "Cosmology", | ||
giturl = "https://github.com/JuliaAstro/Cosmology.jl.git", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Orbits & Ephemerides", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "Transits"), | ||
path = "Transits", | ||
name = "Transits", | ||
giturl = "https://github.com/JuliaAstro/Transits.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "sefffal/PlanetOrbits"), | ||
path = "sefffal/PlanetOrbits", | ||
name = "sefffal/PlanetOrbits", | ||
giturl = "https://github.com/sefffal/PlanetOrbits.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "EarthOrientation"), | ||
path = "EarthOrientation", | ||
name = "EarthOrientation", | ||
giturl = "https://github.com/JuliaAstro/EarthOrientation.jl.git", | ||
), | ||
MultiDocumenter.Link( | ||
"JPLEphemeris", | ||
"https://github.com/JuliaAstro/JPLEphemeris.jl", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "AstroLib"), | ||
path = "AstroLib", | ||
name = "AstroLib", | ||
giturl = "https://github.com/JuliaAstro/AstroLib.jl.git", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Numerical Utilities", | ||
[ | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "BoxLeastSquares"), | ||
path = "BoxLeastSquares", | ||
name = "BoxLeastSquares", | ||
giturl = "https://github.com/JuliaAstro/BoxLeastSquares.jl.git", | ||
), | ||
MultiDocumenter.MultiDocRef( | ||
upstream = joinpath(clonedir, "LombScargle"), | ||
path = "LombScargle", | ||
name = "LombScargle", | ||
giturl = "https://github.com/JuliaAstro/LombScargle.jl.git", | ||
), | ||
] | ||
), | ||
MultiDocumenter.DropdownNav( | ||
"Statistics", | ||
[ | ||
MultiDocumenter.Link( | ||
"sefffal/PairPlots", | ||
"https://sefffal.github.io/PairPlots.jl/dev", | ||
), | ||
] | ||
), | ||
] | ||
|
||
MultiDocumenter.make( | ||
outpath, | ||
docs; | ||
assets_dir = "docs/src/assets", | ||
search_engine = MultiDocumenter.SearchConfig( | ||
index_versions = ["stable"], | ||
engine = MultiDocumenter.FlexSearch | ||
), | ||
rootpath = "/previews/PR43/", | ||
canonical_domain = "https://JuliaAstro.org/", | ||
brand_image = MultiDocumenter.BrandImage(".", joinpath("assets", "logo.svg")), | ||
sitemap = true, | ||
) | ||
@info "Aggregate build done" | ||
|
||
# Download logo | ||
assets_dir = joinpath(outpath, "assets") | ||
mkpath(assets_dir) | ||
Downloads.download( | ||
"https://raw.githubusercontent.com/JuliaAstro/JuliaAstro.github.io/refs/heads/source/docs/src/assets/logo.svg", | ||
joinpath(assets_dir, "logo.svg"); | ||
verbose = true, | ||
) | ||
@info "Final build done" | ||
|
||
@info "Deployng docs" | ||
#if "--deploy" in ARGS | ||
# @warn "Deploying to GitHub" ARGS | ||
# gitroot = normpath(joinpath(@__DIR__, "..")) | ||
# run(`git pull`) | ||
# outbranch = "master" | ||
# has_outbranch = true | ||
# if !success(`git checkout $outbranch`) | ||
# has_outbranch = false | ||
# if !success(`git switch --orphan $outbranch`) | ||
# @error "Cannot create new orphaned branch $outbranch." | ||
# exit(1) | ||
# end | ||
# end | ||
# for file in readdir(gitroot; join = true) | ||
# (endswith(file, ".git") || (basename(file) == "CNAME")) && 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 source`) | ||
# else | ||
# @info "No changes to aggregated documentation." | ||
# end | ||
#else | ||
# @info "Skipping deployment, 'deploy' not passed. Generated files in docs/$(outpath)." ARGS | ||
# cp(outpath, joinpath(@__DIR__, "build"), force = true) | ||
#end | ||
|
||
deploydocs(; | ||
repo = "github.com/JuliaAstro/JuliaAstro.github.io", | ||
push_preview = true, | ||
branch = "master", | ||
devbranch = "source" | ||
devbranch = "multidocumenter", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be changed back to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You read my mind. Wasn't sure how that would play with PR doc previews, but totally happy to switch it back if it looks good to you! |
||
versions = nothing, | ||
) | ||
@info "Deploy complete" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This bit is all manual and gross for now just to stand things up, and can be replaced by something like #44 if we end up wanting to go the "single source of truth" route discussed there