@@ -49,25 +49,72 @@ jobs:
49
49
-
uses :
julia-actions/[email protected]
50
50
continue-on-error : true
51
51
52
- Documentation :
52
+ docs :
53
+ name : Documentation
53
54
runs-on : ubuntu-latest
54
55
steps :
55
56
- 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
63
58
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'
72
118
env :
119
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73
120
DOCUMENTER_KEY : ${{ secrets.DOCUMENTER_KEY }}
0 commit comments