Skip to content

Commit 3fb73a6

Browse files
authored
Merge pull request #3 from JuliaAI/dev
set push_preview=true in doc generation
2 parents 9091324 + 9575e2a commit 3fb73a6

File tree

2 files changed

+65
-17
lines changed

2 files changed

+65
-17
lines changed

.github/workflows/CI.yml

Lines changed: 63 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,72 @@ jobs:
4949
- uses: julia-actions/[email protected]
5050
continue-on-error: true
5151

52-
Documentation:
52+
docs:
53+
name: Documentation
5354
runs-on: ubuntu-latest
5455
steps:
5556
- uses: actions/checkout@v2
56-
- uses: julia-actions/setup-julia@latest
57-
with:
58-
version: 1
59-
- name: Cache artifacts
60-
uses: actions/cache@v2
61-
env:
62-
cache-name: cache-artifacts
57+
- uses: julia-actions/setup-julia@v1
6358
with:
64-
path: |
65-
~/.julia/artifacts
66-
key: ${{ runner.os }}-test-${{ env.cache-name }}-${{ hashFiles('**/docs/Project.toml') }}
67-
restore-keys: |
68-
${{ runner.os }}-test-${{ env.cache-name }}-
69-
${{ runner.os }}-test-
70-
${{ runner.os }}-
71-
- uses: julia-actions/julia-docdeploy@releases/v1
59+
version: '1'
60+
- run: |
61+
julia -e '
62+
function set_environment_variable(name::AbstractString, value::AbstractString)
63+
github_env = ENV["GITHUB_ENV"]
64+
touch(github_env)
65+
open(github_env, "a") do io
66+
println(io, "$(name)=$(value)")
67+
end
68+
end
69+
event_name = "${{ github.event_name }}"
70+
if event_name == "pull_request"
71+
base_ref = "${{ github.base_ref }}"
72+
head_ref = "${{ github.head_ref }}"
73+
base_repository = "${{ github.repository }}"
74+
head_repository = "${{ github.event.pull_request.head.repo.full_name }}"
75+
build_docs = (base_ref == "master") && (head_ref == "dev") && (base_repository == head_repository)
76+
elseif event_name == "push"
77+
ref = "${{ github.ref }}"
78+
build_docs = (ref == "refs/heads/master") || (startswith(ref, "refs/tags/"))
79+
elseif event_name == "schedule"
80+
build_docs = ref == "refs/heads/master"
81+
elseif event_name == "workflow_dispatch"
82+
build_docs = ref == "refs/heads/master"
83+
else
84+
build_docs = false
85+
end
86+
if build_docs
87+
@info("We will build the docs")
88+
set_environment_variable("BUILD_DOCS", "true")
89+
else
90+
@info("We will NOT build the docs")
91+
set_environment_variable("BUILD_DOCS", "false")
92+
end'
93+
- run: |
94+
julia --project=docs -e '
95+
if ENV["BUILD_DOCS"] == "true"
96+
using Pkg
97+
Pkg.develop(PackageSpec(path=pwd()))
98+
Pkg.instantiate()
99+
end'
100+
- run: |
101+
julia --project=docs -e '
102+
if ENV["BUILD_DOCS"] == "true"
103+
using Documenter: doctest
104+
using OpenML
105+
@info "attempting to run the doctests"
106+
doctest(OpenML)
107+
else
108+
@info "skipping the doctests"
109+
end'
110+
- run: julia --project=docs -e '
111+
if ENV["BUILD_DOCS"] == "true"
112+
@info "attempting to build the docs"
113+
run(`julia --project=docs docs/make.jl`)
114+
@info "successfully built the docs"
115+
else
116+
@info "skipping the docs build"
117+
end'
72118
env:
119+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73120
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

docs/make.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ makedocs(
66
)
77

88
deploydocs(
9-
repo = "github.com/JuliaAI/OpenML.jl.git",
9+
repo = "github.com/JuliaAI/OpenML.jl",
10+
push_preview = true
1011
)

0 commit comments

Comments
 (0)