From 9a5e552ca0f879dcb6c089bfe7607280086ae25d Mon Sep 17 00:00:00 2001 From: Charles Hall Date: Sun, 9 Jun 2024 12:52:45 -0700 Subject: [PATCH] set up mdbook This adds some new tools in CI for lint the book and also sets up automated deployment to GitLab Pages. Also adds a readme that suggests reading the book, since that's where all the information will be. --- .gitignore | 3 +++ .gitlab-ci.yml | 12 ++++++++++++ .lycheeignore | 1 + .markdownlintignore | 1 + README.md | 9 +++++++++ book.toml | 12 ++++++++++++ book/SUMMARY.md | 3 +++ book/introduction.md | 1 + engage.toml | 20 ++++++++++++++++++++ nix/shell.nix | 6 ++++++ 10 files changed, 68 insertions(+) create mode 120000 .lycheeignore create mode 120000 .markdownlintignore create mode 100644 README.md create mode 100644 book.toml create mode 100644 book/SUMMARY.md create mode 100644 book/introduction.md diff --git a/.gitignore b/.gitignore index a17d5fe5..4fba1aea 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,6 @@ result* # GitLab CI cache /.gitlab-ci.d + +# mdbook artifacts +/public diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index aba71d2e..71632f4a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - ci - artifacts + - deploy variables: # Makes some things print in color @@ -48,3 +49,14 @@ artifacts: image: nixos/nix:2.18.2 script: - ./bin/nix-build-and-cache packages + +pages: + stage: deploy + image: nixos/nix:2.18.2 + script: + - direnv exec . mdbook build + artifacts: + paths: + - public + only: + - main diff --git a/.lycheeignore b/.lycheeignore new file mode 120000 index 00000000..3e4e48b0 --- /dev/null +++ b/.lycheeignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/.markdownlintignore b/.markdownlintignore new file mode 120000 index 00000000..3e4e48b0 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +.gitignore \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 00000000..3f4c2c9a --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Grapevine + +A Matrix homeserver. + +## Read the book + +[Click here to read the latest version.][0] + +[0]: https://matrix.pages.gitlab.computer.surgery/grapevine-fork/ diff --git a/book.toml b/book.toml new file mode 100644 index 00000000..f71ac6e0 --- /dev/null +++ b/book.toml @@ -0,0 +1,12 @@ +[book] +title = "Grapevine" +language = "en" +multilingual = false +src = "book" + +[build] +build-dir = "public" + +[output.html] +git-repository-icon = "fa-git-square" +git-repository-url = "https://gitlab.computer.surgery/matrix/grapevine-fork" diff --git a/book/SUMMARY.md b/book/SUMMARY.md new file mode 100644 index 00000000..6ed14891 --- /dev/null +++ b/book/SUMMARY.md @@ -0,0 +1,3 @@ +# Summary + +* [Introduction](./introduction.md) diff --git a/book/introduction.md b/book/introduction.md new file mode 100644 index 00000000..e10b99d0 --- /dev/null +++ b/book/introduction.md @@ -0,0 +1 @@ +# Introduction diff --git a/engage.toml b/engage.toml index 19acec13..3e5d4417 100644 --- a/engage.toml +++ b/engage.toml @@ -30,6 +30,26 @@ name = "cargo-clippy" group = "versions" script = "cargo clippy -- --version" +[[task]] +name = "lychee" +group = "versions" +script = "lychee --version" + +[[task]] +name = "markdownlint" +group = "versions" +script = "markdownlint --version" + +[[task]] +name = "lychee" +group = "lints" +script = "lychee --offline ." + +[[task]] +name = "markdownlint" +group = "lints" +script = "markdownlint ." + [[task]] name = "cargo-fmt" group = "lints" diff --git a/nix/shell.nix b/nix/shell.nix index ebfe1dc6..354edf7a 100644 --- a/nix/shell.nix +++ b/nix/shell.nix @@ -3,6 +3,9 @@ , engage , inputs , jq +, lychee +, markdownlint-cli +, mdbook , mkShell , system , toolchain @@ -27,6 +30,9 @@ mkShell { # Keep sorted engage jq + lychee + markdownlint-cli + mdbook toolchain ] ++