Skip to content

Commit

Permalink
Modify make.jl to deploy to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-lindquist committed Aug 8, 2018
1 parent 935c869 commit 80d1ae8
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The TypeStability.jl package is licensed under the MIT "Expat" License:
Copyright (c) 2018: Neil Lindquist.

> Copyright (c) 2018: Neil Lindquist.
>
> Permission is hereby granted, free of charge, to any person obtaining a copy
> of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Run `Pkg.clone("https://github.com/Collegeville/TypeStability.jl.git")` to insta

### Example

Documentation is located at collegeville.github.io/TypeStability.jl/latest/

The function `enable_inline_stability_checks(::Bool)` enables running the stability checks, while the macro `@stablefunction(signatures, function)` handles running the checks.

```julia
Expand Down
39 changes: 26 additions & 13 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ end

makedocs(modules = [TypeStability])

success(`/bin/python -m mkdocs build`) ||
error("couldn't build docs")

#deploydocs(deps = Deps.pip("mkdocs", "python-markdown-math"),
# repo = "github.com/Collegeville/TypeStability.jl")

#The following code is a modified copy of deploydocs in Documenter.jl
# The following code is a modified copy of deploydocs in Documenter.jl
# Documenter.jl is copyright 2016, Michael Hatherly and is licensed under the MIT "Expat" License
# See LICENSE.md for a copy of the MIT "Expat" License
target_dir = abspath("site")
println("target_dir = $target_dir")

sha = try
readchomp(`git rev-parse --short HEAD`)
Expand All @@ -24,7 +30,12 @@ sha = try
mktempdir() do temp
latest_dir = joinpath(temp, "latest")
stable_dir = joinpath(temp, "stable")
tagged_dir = joinpath(temp, tag)

if tag == nothing
tagged_dir = joinpath(temp, "unknowntag")
else
tagged_dir = joinpath(temp, tag)
end


cd(temp) do
Expand All @@ -33,32 +44,34 @@ mktempdir() do temp
run(`git config user.email "autodocs"`)

# Fetch from remote and checkout the branch.
success(`git remote add upstream git:github.com/Collegeville/TypeStability.jl.git`) ||
success(`git remote add upstream https://github.com/Collegeville/TypeStability.jl.git`) ||
error("could not add new remote repo.")

success(`git fetch upstream`) ||
error("could not fetch from remote.")

#if previous tagged versions are present, use them instead
run(`git checkout upstream/gh-pages`)


run(`git rm -rf --ignore-unmatch $latest_dir`)
cp(target_dir, latest_dir)
Documenter.Writers.HTMLWriter.generate_siteinfo_file(latest_dir, "latest")

if tag == nothing
# --ignore-unmatch so that we wouldn't get errors if dst does not exist
run(`git rm -rf --ignore-unmatch $latest_dir`)
cp(target_dir, latest_dir)
Writers.HTMLWriter.generate_siteinfo_file(latest_dir, "latest")
else
if tag !== nothing
run(`git rm -rf --ignore-unmatch $stable_dir $tagged_dir`)
cp(target_dir, stable_dir)
cp(target_dir, tagged_dir)
Writers.HTMLWriter.generate_siteinfo_file(stable_dir, "stable")
Writers.HTMLWriter.generate_siteinfo_file(tagged_dir, tag)
Documenter.Writers.HTMLWriter.generate_siteinfo_file(stable_dir, "stable")
Documenter.Writers.HTMLWriter.generate_siteinfo_file(tagged_dir, tag)
end

Writers.HTMLWriter.generate_version_file(temp)
Documenter.Writers.HTMLWriter.generate_version_file(temp)

run(`git add -A .`)
try run(`git commit -m "build based on $sha"`) end

success(`git push -q upstream HEAD:master`) ||
success(`git push -q upstream +HEAD:gh-pages`) ||
error("could not push to remote repo.")
end
end

0 comments on commit 80d1ae8

Please sign in to comment.