Skip to content

Commit

Permalink
docs: Add new visual docs site (#168)
Browse files Browse the repository at this point in the history
  • Loading branch information
m1sk9 authored Aug 3, 2024
1 parent e949202 commit cd81475
Show file tree
Hide file tree
Showing 13 changed files with 325 additions and 194 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Deploy CommandReference

on:
push:
branches: [ main ]
paths:
- 'docs/**'
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
env:
# renovate: rust-lang/mdBook
MDBOOK_VERSION: '0.4.40'

# renovate: slowsage/mdbook-pagetoc
MDBOOK_PAGETOC_VERSION: '0.2.0'

# renovate: lambdalisue/rs-mdbook-alerts
MDBOOK_ALERTS_VERSION: '0.5.2'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Install mdbook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: ${{ env.MDBOOK_VERSION }}

- name: Setup cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: "babyrite-docs/gh-actions-cache"

- name: Install mdbook plugins
run: |
cargo install mdbook-pagetoc --version ${{ env.MDBOOK_PAGETOC_VERSION }}
cargo install mdbook-alerts --version ${{ env.MDBOOK_ALERTS_VERSION }}
- name: Build with mdbook
run: |
cd docs
mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./src/build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
.env
/docs/build
36 changes: 10 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,34 @@
# babyrite

[![Release babyrite](https://github.com/m1sk9/babyrite/actions/workflows/release.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/release.yaml)
[![Build babyrite](https://github.com/m1sk9/babyrite/actions/workflows/build.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/build.yaml)
[![clippy](https://github.com/m1sk9/babyrite/actions/workflows/clippy.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/clippy.yaml)
[![rustfmt](https://github.com/m1sk9/babyrite/actions/workflows/fmt.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/fmt.yaml)
[![Build](https://github.com/m1sk9/babyrite/actions/workflows/ci.yaml/badge.svg)](https://github.com/m1sk9/babyrite/actions/workflows/ci.yaml)

A citation message Discord bot

![babyrite example](docs/example.gif)

## Features

- メッセージリンクのメッセージ内容を展開する
![babyrite example](docs/src/public/example.gif)

## Installation

babyrite の Docker Image ghcr.io から取得することができます.
Can get babyrite Docker Image from ghcr.io:

```shell
# 最新版
# latest version
docker pull ghcr.io/m1sk9/babyrite:latest

# マイナーバージョン (v0.x)
## 破壊的変更がない限りは互換性があります. こちらから取得することをおすすめします.
# Minor version (v0.x) - recommended
docker pull ghcr.io/m1sk9/babyrite:v0

# バージョン指定
docker pull ghcr.io/m1sk9/babyrite:vX.Y.Z
```

取得した Docker Image に対して環境変数を与えると babyrite を起動できます.
You can start babyrite by providing environment variables for the Docker Image you have obtained.

詳しいセットアップ方法は [babyrite docs](./docs/README.md) を参照してください.
See [babyrite docs](. /docs/README.md) for detailed setup instructions.

## Environment Variables

以下は babyrite が利用する環境変数です.
The following are environment variables used by babyrite.

`Required` カラムが `Yes` の Key は指定必須です. 指定しない場合は正しく起動しません.
Key whose `Required` column is `Yes` must be specified. If not specified, babyrite will not start correctly.

| Key | Description | Required | Default |
| --- | ----------- | -------- | ------- |
| `DISCORD_API_TOKEN` | Discord API トークン | Yes | --- |

環境変数の設定例は [`.env.example`](.env.example) を参照してください.

```shell
cp .env.example .env
```
| `DISCORD_API_TOKEN` | Discord API Token | Yes | --- |
1 change: 1 addition & 0 deletions docs/CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
babyrite.m1sk9.dev
168 changes: 0 additions & 168 deletions docs/README.md

This file was deleted.

25 changes: 25 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[book]
language = "ja"
description = "The documentation for babyrite"
src = "src"
title = "babyrite docs"
multilingual = false
authors = ["m1sk9"]

[rust]
edition = "2021"

[build]
build-dir = "build"
create-missing = false
use-default-preprocessors = true

[output.html]
git-repository-url = "https://github.com/m1sk9/babyrite"
edit-url-template = "https://github.com/m1sk9/babyrite/edit/main/docs/{path}"

[preprocessor.alerts]

[preprocessor.toc]
command = "mdbook-toc"
renderer = ["html"]
10 changes: 10 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Summary

[Ovewview](./overview.md)

[Installation](./installation.md)

[Setup](./setup.md)

[Configuration](./configuration.md)

32 changes: 32 additions & 0 deletions docs/src/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Configuration

<!-- toc -->

## Change the displayed logs

Since babyrite uses [tracing, traching-subscriber](https://github.com/tokio-rs/tracing) for logging, you can change the displayed logs by setting the environment variable `RUST_LOG` at startup.

```shell
RUST_LOG=babyrite=info cargo run
RUST_LOG=babyrite=debug cargo run
RUST_LOG=babyrite=info ./target/release/babyrite
```

The default behavior is as follows:

- When `RUST_LOG` is not set, running cargo run or the binary directly will display babyrite logs including debug events.
- Running the Docker image will display babyrite logs with `info` events only.

> [!NOTE]
>
> `babyrite=` specifies the logs for the babyrite. Therefore, if you specify a crate other than babyrite in RUST_LOG (e.g. `RUST_LOG=serenity=info`), the logs for that crate will be displayed.
## Set Sentry DSN (deprecated)

> [!WARNING]
>
> Sentry support was removed in [v0.8.0](https://github.com/m1sk9/babyrite/releases/tag/v0.8.0).
By setting the environment variable SENTRY_DSN to a Sentry DSN, babyrite will send errors to Sentry.

For more information about Sentry, refer to [the official site](https://sentry.io/).
Loading

0 comments on commit cd81475

Please sign in to comment.