Skip to content

Commit 158e4fe

Browse files
icweaverabhro
andauthored
Use MultiDocumenter.jl (#43)
* Removing hosting of other packages' docs * Add docs site link for AstroAngles.jl * Update assets link * Add GitHub token secret to docs CI * first pass at multidocs * src different than dst * trying deploy * split workflow steps * instantiate * going back to docdeploy action * no orphans * try deploydocs directly * update branches and switch deploy method * back to deploydocs * back to manual deploy * typo? * whitespace * specify branch * cleanup * Use shell option for workflow yml * Use julia color option for docs/make.jl workflow step * Add favicon to Documenter.HTML() assets * Add versions keyword to deploydocs() * Trying updated search path * trying temporary PR preview root for universal search functionality * fix search path * enabled sitemap again * typo * Change devbranch in deploydocs back to source --------- Co-authored-by: Abhro R <[email protected]>
1 parent d81725a commit 158e4fe

6 files changed

Lines changed: 299 additions & 133 deletions

File tree

.github/workflows/Documentation.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,24 @@ on:
77
- cron: '15 2 * * *' # 2:15 AM UTC every day
88
jobs:
99
docs:
10-
name: Documentation
10+
name: MultiDocumentation
1111
runs-on: ubuntu-latest
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: julia-actions/setup-julia@v2
1515
with:
1616
version: "1"
1717
- uses: julia-actions/cache@v2
18-
- uses: julia-actions/julia-docdeploy@v1
18+
- name: Install dependencies
19+
shell: julia --color=yes --project=docs {0}
20+
run: |
21+
using Pkg
22+
Pkg.instantiate()
23+
- name: Aggregate and deploy
24+
run: |
25+
git config user.name github-actions
26+
git config user.email [email protected]
27+
julia --color=yes --project=docs docs/make.jl --deploy
1928
env:
2029
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
2130
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

docs/Project.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
3+
MultiDocumenter = "87ed4bf0-c935-4a67-83c3-2a03bee4197c"
34
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
45

56
[compat]

docs/make.jl

Lines changed: 275 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,23 @@
1-
using LibGit2, Pkg, TOML, UUIDs
1+
using MultiDocumenter, Documenter
2+
using LibGit2, Pkg, TOML, UUIDs, Downloads
23

34
# This make file compiles the documentation for the JuliaAstro website.
4-
# It consists of the usual documeter structure, but also follows the approach
5+
# It consists of the usual documenter structure, but also follows the approach
56
# of the SciML docs page https://github.com/SciML/SciMLDocs/blob/main/docs/make.jl
67
# by generating nested documentation for packages under the JuliaAstro organization.
7-
# That way, docs for all packages are browesable and searchable in one place!
8+
# That way, docs for all packages are browsable and searchable in one place!
89

9-
include("install.jl")
10+
clonedir = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "clones")
11+
outpath = ("--temp" in ARGS) ? mktempdir(; cleanup=false) : joinpath(@__DIR__, "build")
1012

11-
for depe in to_use
12-
eval(quote
13-
using $depe
14-
push!(allmods, $depe)
15-
end)
16-
end
13+
@info """
14+
Cloning packages into: $(clonedir)
15+
Building aggregate site into: $(outpath)
16+
"""
1717

18-
# We wait to import Documenter in case one of the packages requires
19-
# an older version. If that was the case, it's version may have changed
20-
# after the above for-loop
21-
using Documenter
18+
@info "Building MultiDocumenter site for JuliaAstro"
2219

20+
include("pages.jl")
2321
mathengine = MathJax3(Dict(
2422
:loader => Dict("load" => ["[tex]/require", "[tex]/mathtools"]),
2523
:tex => Dict(
@@ -31,25 +29,285 @@ mathengine = MathJax3(Dict(
3129
makedocs(
3230
sitename="JuliaAstro",
3331
authors = "Julia Astro Contributors",
34-
modules=identity.(allmods),
3532
clean=true,
3633
doctest=false,
3734
format=Documenter.HTML(
3835
mathengine=mathengine,
3936
prettyurls = get(ENV, "CI", "false") == "true",
40-
canonical = "https://juliaastro.github.io/",
37+
canonical = "https://juliaastro.org/",
4138
assets = String[
4239
"assets/styles.css",
40+
"assets/favicon.ico",
4341
],
4442
),
4543
pages=fullpages,
4644
warnonly=[:missing_docs],
4745
)
4846

47+
@info "Building aggregate JuliaAstro site"
48+
docs = [
49+
# We also add JuliaAstro's own generated pages
50+
MultiDocumenter.MultiDocRef(
51+
upstream = joinpath(@__DIR__, "build"),
52+
path = "docs",
53+
name = "JuliaAstro",
54+
fix_canonical_url = false,
55+
),
56+
MultiDocumenter.DropdownNav(
57+
"Time, Coordinates, & Units",
58+
[
59+
MultiDocumenter.MultiDocRef(
60+
upstream = joinpath(clonedir, "AstroAngles"),
61+
path = "AstroAngles",
62+
name = "AstroAngles",
63+
giturl = "https://github.com/JuliaAstro/AstroAngles.jl.git",
64+
),
65+
MultiDocumenter.MultiDocRef(
66+
upstream = joinpath(clonedir, "AstroTime"),
67+
path = "AstroTime",
68+
name = "AstroTime",
69+
giturl = "https://github.com/JuliaAstro/AstroTime.jl.git",
70+
),
71+
MultiDocumenter.MultiDocRef(
72+
upstream = joinpath(clonedir, "ERFA"),
73+
path = "ERFA",
74+
name = "ERFA",
75+
giturl = "https://github.com/JuliaAstro/ERFA.jl.git",
76+
),
77+
MultiDocumenter.MultiDocRef(
78+
upstream = joinpath(clonedir, "SkyCoords"),
79+
path = "SkyCoords",
80+
name = "SkyCoords",
81+
giturl = "https://github.com/JuliaAstro/SkyCoords.jl.git",
82+
),
83+
MultiDocumenter.MultiDocRef(
84+
upstream = joinpath(clonedir, "UnitfulAstro"),
85+
path = "UnitfulAstro",
86+
name = "UnitfulAstro",
87+
giturl = "https://github.com/JuliaAstro/UnitfulAstro.jl.git",
88+
),
89+
MultiDocumenter.MultiDocRef(
90+
upstream = joinpath(clonedir, "WCS"),
91+
path = "WCS",
92+
name = "WCS",
93+
giturl = "https://github.com/JuliaAstro/WCS.jl.git",
94+
),
95+
]
96+
),
97+
MultiDocumenter.DropdownNav(
98+
"Images",
99+
[
100+
MultiDocumenter.MultiDocRef(
101+
upstream = joinpath(clonedir, "AstroImages"),
102+
path = "AstroImages",
103+
name = "AstroImages",
104+
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git",
105+
),
106+
MultiDocumenter.MultiDocRef(
107+
upstream = joinpath(clonedir, "SAOImagesDS9"),
108+
path = "SAOImagesDS9",
109+
name = "SAOImagesDS9",
110+
giturl = "https://github.com/JuliaAstro/SAOImageDS9.jl.git",
111+
),
112+
MultiDocumenter.MultiDocRef(
113+
upstream = joinpath(clonedir, "Photometry"),
114+
path = "Photometry",
115+
name = "Photometry",
116+
giturl = "https://github.com/juliaastro/Photometry.jl.git",
117+
),
118+
MultiDocumenter.MultiDocRef(
119+
upstream = joinpath(clonedir, "PSFModels"),
120+
path = "PSFModels",
121+
name = "PSFModels",
122+
giturl = "https://github.com/juliaastro/PSFModels.jl.git",
123+
),
124+
MultiDocumenter.MultiDocRef(
125+
upstream = joinpath(clonedir, "LACosmic"),
126+
path = "LACosmic",
127+
name = "LACosmic",
128+
giturl = "https://github.com/juliaastro/LACosmic.jl.git",
129+
),
130+
]
131+
),
132+
MultiDocumenter.DropdownNav(
133+
"Data I/O",
134+
[
135+
MultiDocumenter.MultiDocRef(
136+
upstream = joinpath(clonedir, "AstroImages"),
137+
path = "AstroImages",
138+
name = "AstroImages",
139+
giturl = "https://github.com/JuliaAstro/AstroImages.jl.git",
140+
),
141+
MultiDocumenter.MultiDocRef(
142+
upstream = joinpath(clonedir, "FITSIO"),
143+
path = "FITSIO",
144+
name = "FITSIO",
145+
giturl = "https://github.com/JuliaAstro/FITSIO.jl.git",
146+
),
147+
MultiDocumenter.MultiDocRef(
148+
upstream = joinpath(clonedir, "CFITSIO"),
149+
path = "CFITSIO",
150+
name = "CFITSIO",
151+
giturl = "https://github.com/JuliaAstro/CFITSIO.jl.git",
152+
),
153+
MultiDocumenter.Link(
154+
"mweastwood/CasaCore",
155+
"http://mweastwood.info/CasaCore.jl/stable/",
156+
),
157+
MultiDocumenter.Link(
158+
"emmt/OIFITS",
159+
"https://github.com/emmt/OIFITS.jl",
160+
),
161+
MultiDocumenter.Link(
162+
"aplavin/VLBIData",
163+
"https://github.com/JuliaAPlavin/VLBIData.jl",
164+
),
165+
MultiDocumenter.Link(
166+
"aplavin/Difmap",
167+
"https://github.com/JuliaAPlavin/Difmap.jl",
168+
),
169+
]
170+
),
171+
MultiDocumenter.DropdownNav(
172+
"Cosmology",
173+
[
174+
MultiDocumenter.MultiDocRef(
175+
upstream = joinpath(clonedir, "Cosmology"),
176+
path = "Cosmology",
177+
name = "Cosmology",
178+
giturl = "https://github.com/JuliaAstro/Cosmology.jl.git",
179+
),
180+
]
181+
),
182+
MultiDocumenter.DropdownNav(
183+
"Orbits & Ephemerides",
184+
[
185+
MultiDocumenter.MultiDocRef(
186+
upstream = joinpath(clonedir, "Transits"),
187+
path = "Transits",
188+
name = "Transits",
189+
giturl = "https://github.com/JuliaAstro/Transits.jl.git",
190+
),
191+
MultiDocumenter.MultiDocRef(
192+
upstream = joinpath(clonedir, "sefffal/PlanetOrbits"),
193+
path = "sefffal/PlanetOrbits",
194+
name = "sefffal/PlanetOrbits",
195+
giturl = "https://github.com/sefffal/PlanetOrbits.jl.git",
196+
),
197+
MultiDocumenter.MultiDocRef(
198+
upstream = joinpath(clonedir, "EarthOrientation"),
199+
path = "EarthOrientation",
200+
name = "EarthOrientation",
201+
giturl = "https://github.com/JuliaAstro/EarthOrientation.jl.git",
202+
),
203+
MultiDocumenter.Link(
204+
"JPLEphemeris",
205+
"https://github.com/JuliaAstro/JPLEphemeris.jl",
206+
),
207+
MultiDocumenter.MultiDocRef(
208+
upstream = joinpath(clonedir, "AstroLib"),
209+
path = "AstroLib",
210+
name = "AstroLib",
211+
giturl = "https://github.com/JuliaAstro/AstroLib.jl.git",
212+
),
213+
]
214+
),
215+
MultiDocumenter.DropdownNav(
216+
"Numerical Utilities",
217+
[
218+
MultiDocumenter.MultiDocRef(
219+
upstream = joinpath(clonedir, "BoxLeastSquares"),
220+
path = "BoxLeastSquares",
221+
name = "BoxLeastSquares",
222+
giturl = "https://github.com/JuliaAstro/BoxLeastSquares.jl.git",
223+
),
224+
MultiDocumenter.MultiDocRef(
225+
upstream = joinpath(clonedir, "LombScargle"),
226+
path = "LombScargle",
227+
name = "LombScargle",
228+
giturl = "https://github.com/JuliaAstro/LombScargle.jl.git",
229+
),
230+
]
231+
),
232+
MultiDocumenter.DropdownNav(
233+
"Statistics",
234+
[
235+
MultiDocumenter.Link(
236+
"sefffal/PairPlots",
237+
"https://sefffal.github.io/PairPlots.jl/dev",
238+
),
239+
]
240+
),
241+
]
242+
243+
MultiDocumenter.make(
244+
outpath,
245+
docs;
246+
assets_dir = "docs/src/assets",
247+
search_engine = MultiDocumenter.SearchConfig(
248+
index_versions = ["stable"],
249+
engine = MultiDocumenter.FlexSearch
250+
),
251+
rootpath = "/previews/PR43/",
252+
canonical_domain = "https://JuliaAstro.org/",
253+
brand_image = MultiDocumenter.BrandImage(".", joinpath("assets", "logo.svg")),
254+
sitemap = true,
255+
)
256+
@info "Aggregate build done"
257+
258+
# Download logo
259+
assets_dir = joinpath(outpath, "assets")
260+
mkpath(assets_dir)
261+
Downloads.download(
262+
"https://raw.githubusercontent.com/JuliaAstro/JuliaAstro.github.io/refs/heads/source/docs/src/assets/logo.svg",
263+
joinpath(assets_dir, "logo.svg");
264+
verbose = true,
265+
)
266+
@info "Final build done"
267+
268+
@info "Deployng docs"
269+
#if "--deploy" in ARGS
270+
# @warn "Deploying to GitHub" ARGS
271+
# gitroot = normpath(joinpath(@__DIR__, ".."))
272+
# run(`git pull`)
273+
# outbranch = "master"
274+
# has_outbranch = true
275+
# if !success(`git checkout $outbranch`)
276+
# has_outbranch = false
277+
# if !success(`git switch --orphan $outbranch`)
278+
# @error "Cannot create new orphaned branch $outbranch."
279+
# exit(1)
280+
# end
281+
# end
282+
# for file in readdir(gitroot; join = true)
283+
# (endswith(file, ".git") || (basename(file) == "CNAME")) && continue
284+
# rm(file; force = true, recursive = true)
285+
# end
286+
# for file in readdir(outpath)
287+
# cp(joinpath(outpath, file), joinpath(gitroot, file))
288+
# end
289+
# run(`git add .`)
290+
# if success(`git commit -m 'Aggregate documentation'`)
291+
# @info "Pushing updated documentation."
292+
# if has_outbranch
293+
# run(`git push`)
294+
# else
295+
# run(`git push -u origin $outbranch`)
296+
# end
297+
# run(`git checkout source`)
298+
# else
299+
# @info "No changes to aggregated documentation."
300+
# end
301+
#else
302+
# @info "Skipping deployment, 'deploy' not passed. Generated files in docs/$(outpath)." ARGS
303+
# cp(outpath, joinpath(@__DIR__, "build"), force = true)
304+
#end
49305

50306
deploydocs(;
51307
repo = "github.com/JuliaAstro/JuliaAstro.github.io",
52308
push_preview = true,
53309
branch = "master",
54-
devbranch = "source"
310+
devbranch = "source",
311+
versions = nothing,
55312
)
313+
@info "Deploy complete"

0 commit comments

Comments
 (0)