Skip to content

Commit 4240832

Browse files
authored
PR preview docs (#105)
* 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
1 parent c8d01a3 commit 4240832

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
[![Travis](https://travis-ci.org/JuliaDiff/ChainRules.jl.svg?branch=master)](https://travis-ci.org/JuliaDiff/ChainRules.jl)
44
[![Coveralls](https://coveralls.io/repos/github/JuliaDiff/ChainRules.jl/badge.svg?branch=master)](https://coveralls.io/github/JuliaDiff/ChainRules.jl?branch=master)
5-
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaDiff.github.io/ChainRules.jl/latest)
5+
6+
**Docs:*
7+
[![](https://img.shields.io/badge/docs-master-blue.svg)](https://JuliaDiff.github.io/ChainRules.jl/dev)
8+
[![](https://img.shields.io/badge/docs-stable-blue.svg)](https://JuliaDiff.github.io/ChainRules.jl/stable)
69

710
The ChainRules package provides a variety of common utilities that can be used by downstream automatic differentiation (AD) tools to define and execute forward-, reverse-, and mixed-mode primitives.
811

docs/make.jl

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,24 @@ makedocs(
1414
],
1515
)
1616

17-
deploydocs(repo="github.com/JuliaDiff/ChainRules.jl.git")
17+
const repo="github.com/JuliaDiff/ChainRules.jl.git"
18+
const PR = get(ENV, "TRAVIS_PULL_REQUEST", "false")
19+
if PR == "false"
20+
# Normal case, only deply docs if merging to master or release tagged
21+
deploydocs(repo=repo)
22+
else
23+
@info "Deploying review docs for PR #$PR"
24+
# TODO: remove most of this once https://github.com/JuliaDocs/Documenter.jl/issues/1131 is resolved
25+
26+
# Overwrite Documenter's function for generating the versions.js file
27+
foreach(Base.delete_method, methods(Documenter.Writers.HTMLWriter.generate_version_file))
28+
Documenter.Writers.HTMLWriter.generate_version_file(_, _) = nothing
29+
# Overwrite necessary environment variables to trick Documenter to deploy
30+
ENV["TRAVIS_PULL_REQUEST"] = "false"
31+
ENV["TRAVIS_BRANCH"] = "master"
32+
33+
deploydocs(
34+
devurl="preview-PR$(PR)",
35+
repo=repo,
36+
)
37+
end

0 commit comments

Comments
 (0)