Skip to content

Commit

Permalink
PR preview docs (#105)
Browse files Browse the repository at this point in the history
* PR preview docs

* add link to remind to clean up this code once less evil way is possible

* Update docs/make.jl

* fix typo

* .

* .

* fix docs badge links

* remove debug println

* =highlight readme
  • Loading branch information
oxinabox committed Jan 22, 2020
1 parent 079322c commit e4ff2f1
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,24 @@ makedocs(
],
)

deploydocs(repo="github.com/JuliaDiff/ChainRules.jl.git")
const repo="github.com/JuliaDiff/ChainRules.jl.git"
const PR = get(ENV, "TRAVIS_PULL_REQUEST", "false")
if PR == "false"
# Normal case, only deply docs if merging to master or release tagged
deploydocs(repo=repo)
else
@info "Deploying review docs for PR #$PR"
# TODO: remove most of this once https://github.com/JuliaDocs/Documenter.jl/issues/1131 is resolved

# Overwrite Documenter's function for generating the versions.js file
foreach(Base.delete_method, methods(Documenter.Writers.HTMLWriter.generate_version_file))
Documenter.Writers.HTMLWriter.generate_version_file(_, _) = nothing
# Overwrite necessary environment variables to trick Documenter to deploy
ENV["TRAVIS_PULL_REQUEST"] = "false"
ENV["TRAVIS_BRANCH"] = "master"

deploydocs(
devurl="preview-PR$(PR)",
repo=repo,
)
end

0 comments on commit e4ff2f1

Please sign in to comment.