Skip to content

Commit

Permalink
Merge pull request #56 from sloede/msl/add-documenter
Browse files Browse the repository at this point in the history
Add documentation via Documenter.jl
  • Loading branch information
staticfloat authored Sep 20, 2023
2 parents e8082bc + e914ecb commit 72ff0a6
Show file tree
Hide file tree
Showing 6 changed files with 110 additions and 1 deletion.
24 changes: 24 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Documentation

on:
push:
branches:
- master
tags: '*'
pull_request:

jobs:
build-docs:
permissions:
contents: write
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: julia-actions/setup-julia@v1
with:
version: '1.6'
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Preferences
# Preferences.jl

[![Docs-stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://juliapackaging.github.io/Preferences.jl/stable)
[![Docs-dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://juliapackaging.github.io/Preferences.jl/dev)
[![Continuous Integration][ci-img]][ci-url]
[![Code Coverage][codecov-img]][codecov-url]
[![License: MIT](https://img.shields.io/badge/License-MIT-success.svg)](https://opensource.org/licenses/MIT)

[ci-url]: https://github.com/JuliaPackaging/Preferences.jl/actions?query=workflow%3ACI
[codecov-url]: https://codecov.io/gh/JuliaPackaging/Preferences.jl
Expand Down Expand Up @@ -98,3 +101,12 @@ end
```
Note that these cannot be merged into a single `@static if`. Loading
the package with `using Preferences` must be done on its own.

## Authors
This repository was initiated by Elliot Saba
([@staticfloat](https://github.com/staticfloat)) and continues to be maintained by him and
other contributors.

## License and contributing
Preferences.jl is licensed under the MIT license (see [LICENSE.md](LICENSE.md)).
Contributions by volunteers are welcome!
3 changes: 3 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
build/
src/index.md
src/license.md
6 changes: 6 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[deps]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Preferences = "21216c6a-2e73-6563-6e65-726566657250"

[compat]
Documenter = "1"
55 changes: 55 additions & 0 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
using Documenter
using Preferences

# Copy files and modify them for the docs so that we do not maintain two
# versions manually.
open(joinpath(@__DIR__, "src", "index.md"), "w") do io
# Point to source license file
println(io, """
```@meta
EditURL = "https://github.com/JuliaPackaging/Preferences.jl/blob/master/README.md"
```
""")
# Write the modified contents
for line in eachline(joinpath(dirname(@__DIR__), "README.md"))
line = replace(line, "[LICENSE.md](LICENSE.md)" => "[License](@ref)")
println(io, line)
end
end

open(joinpath(@__DIR__, "src", "license.md"), "w") do io
# Point to source license file
println(io, """
```@meta
EditURL = "https://github.com/JuliaPackaging/Preferences.jl/blob/master/LICENSE.md"
```
""")
# Write the modified contents
println(io, "# License")
println(io, "")
for line in eachline(joinpath(dirname(@__DIR__), "LICENSE.md"))
println(io, "> ", line)
end
end

# Build docs
makedocs(;
sitename = "Preferences.jl",
modules = [Preferences],
format = Documenter.HTML(
prettyurls=get(ENV, "CI", "false") == "true",
canonical = "https://juliapackaging.github.io/Preferences.jl/stable"
),
pages = [
"Home" => "index.md",
"Reference" => "reference.md",
"License" => "license.md"
]
)

# Deploy docs
deploydocs(;
repo = "github.com/JuliaPackaging/Preferences.jl.git",
devbranch = "master",
push_preview = false,
)
9 changes: 9 additions & 0 deletions docs/src/reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Reference

```@meta
CurrentModule = Preferences
```

```@autodocs
Modules = [Preferences]
```

0 comments on commit 72ff0a6

Please sign in to comment.