Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation via Documenter.jl #56

Merged
merged 4 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]
```
Loading