Skip to content

Commit

Permalink
Initical commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertuer committed Nov 7, 2023
0 parents commit 15a3fb2
Show file tree
Hide file tree
Showing 6 changed files with 179 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Aggregate
on:
push:
branches:
- main
jobs:
aggregate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
with:
version: '1.8'
- uses: actions/cache@v1
env:
cache-name: cache-artifacts
with:
path: ~/.julia/artifacts
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/Project.toml') }}
restore-keys: |
${{ runner.os }}-test-${{ env.cache-name }}-
${{ runner.os }}-test-
${{ runner.os }}-
- name: Install dependencies
run: julia --project=docs/ -e 'using Pkg; Pkg.instantiate()'
- name: Aggregate and deploy
run: |
git config user.name github-actions
git config user.email [email protected]
julia --project=docs/ docs/make.jl --deploy
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docs/build
docs/clones
docs/Manifest.toml
5 changes: 5 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# juliamanifolds.github.io

(currenlty in preparation)

A common repository / documentation for all released packages within the JuliaManifolds organisation.
3 changes: 3 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[deps]
LiveServer = "16fef848-5104-11e9-1b77-fb7a48bbb589"
MultiDocumenter = "87ed4bf0-c935-4a67-83c3-2a03bee4197c"
138 changes: 138 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
#!/usr/bin/env julia
#
#

# ##
if "--help" ARGS
println(
"""
docs/make.jl
Render the `JuliaManifolds` GitHub Organisation Multidocumenter with optinal arguments
Arguments
* `--deploy` - deploy docs
* `--help` - print this help and exit without rendering the documentation
* `--temp` – clone the other repositories into a temp folder – otherwise use clones/
* `--deploy` - deploy docs to GitHub Pages
""",
)
exit(0)
end


# ## if docs is not the current active environment, switch to it
# (from https://github.com/JuliaIO/HDF5.jl/pull/1020/) 
if Base.active_project() != joinpath(@__DIR__, "Project.toml")
using Pkg
Pkg.activate(@__DIR__)
Pkg.resolve()
Pkg.instantiate()
end

clonedir = ("--temp" in ARGS) ? mktempdir() : joinpath(@__DIR__, "clones")
outpath = ("--temp" in ARGS) ? mktempdir() : joinpath(@__DIR__, "build")

@info """
Cloning packages into: $(clonedir)
Building aggregate site into: $(outpath)
"""

using MultiDocumenter, LiveServer

# ## Build Menu – for now an entry each
docs = [
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "ManifoldsBase.jl"),
path = "manifoldsbase",
name = "ManifoldsBase.jl",
giturl = "https://github.com/JuliaManifolds/ManifoldsBase.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Manifolds.jl"),
path = "manifolds",
name = "Manifolds.jl",
giturl = "https://github.com/JuliaManifolds/Manifolds.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "Manopt.jl"),
path = "manopt",
name = "Manopt.jl",
giturl = "https://github.com/JuliaManifolds/Manopt.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "ManifoldDiffEq.jl"),
path = "manifolddiffeq",
name = "ManifoldDiffEq.jl",
giturl = "https://github.com/JuliaManifolds/ManifoldDiffEq.jl.git",
),
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "ManifoldDiff.jl"),
path = "manifolddiff",
name = "ManifoldDiff.jl",
giturl = "https://github.com/JuliaManifolds/ManifoldDiff.jl.git",
),
MultiDocumenter.DropdownNav("Examples", [
MultiDocumenter.MultiDocRef(
upstream = joinpath(clonedir, "ManoptExamples.jl"),
path = "manoptexamples",
name = "Manopt Examples",
giturl = "https://github.com/JuliaManifolds/ManoptExamples.jl.git",
),
]),
]

# ## Build docs
MultiDocumenter.make(
outpath,
docs;
assets_dir = "docs/src/assets",
search_engine = MultiDocumenter.SearchConfig(
index_versions = ["stable"],
engine = MultiDocumenter.FlexSearch
),
brand_image = MultiDocumenter.BrandImage("https://juliadocumenter.github.io",
joinpath("assets",
"logo.png")),
)

# ## Deploy
if "--deploy" in ARGS
@warn "Deploying to GitHub" ARGS
gitroot = normpath(joinpath(@__DIR__, ".."))
run(`git pull`)
outbranch = "gh-pages"
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
# Delete all current files on our current branch besides the .git folder
for file in readdir(gitroot; join = true)
endswith(file, ".git") && continue
rm(file; force = true, recursive = true)
end
# copy the rendered docs
for file in readdir(outpath)
cp(joinpath(outpath, file), joinpath(gitroot, file))
end
# Add and commit new files
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 main`)
else
@info "No changes to aggregated documentation."
end
else
@info "Skipping deployment, '--deploy' not passed. Generated files in docs/$(outpath)."
end
# ## Serve ?
Binary file added docs/src/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 15a3fb2

Please sign in to comment.