Skip to content

Commit

Permalink
specs: initialize spec with mdbook (#3186)
Browse files Browse the repository at this point in the history
The time has come. Finally, the node will have a spec. Using mdbook and gh pages as app team.
  • Loading branch information
Wondertan authored Feb 19, 2024
1 parent 5e1895c commit 0350121
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/github_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: github-pages

on:
push:
branches:
- main
paths:
- specs/**
pull_request:
paths:
- specs/**
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: "latest"

- name: Build book
run: mdbook build specs

- name: Deploy main
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./specs/book
# keep_files is to prevent PR preview files from being overwritten.
# If we need to overwrite such files, trigger this workflow manually.
keep_files: ${{ github.event_name != 'workflow_dispatch' }}

- name: Deploy PR preview
# Only run this job if the PR was created from a branch on celestiaorg/celestia-node
# because this job will fail for branches from forks.
# https://github.com/celestiaorg/celestia-app/issues/1506
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
uses: rossjrw/pr-preview-action@v1
with:
source-dir: ./specs/book
1 change: 1 addition & 0 deletions specs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book
13 changes: 13 additions & 0 deletions specs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[book]
authors = ["Celestia Labs"]
language = "en"
multilingual = false
src = "src"
title = "Celestia Node Specification"

[output.html]
git-repository-url = "https://github.com/celestiaorg/celestia-node"

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

- [WIP](./WIP.md)
1 change: 1 addition & 0 deletions specs/src/WIP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# WIP

0 comments on commit 0350121

Please sign in to comment.