Files
pezkuwi-fellows/.github/workflows/mdbook.yml
T
Przemek Rzad f94ab697e5 Introduce RFC mdBook web page (#60)
- Closes https://github.com/polkadot-fellows/RFCs/issues/53
- Preview available [here](https://paritytech.github.io/RFCs/).

![Screenshot 2023-12-19 at 13 55
05](https://github.com/polkadot-fellows/RFCs/assets/12039224/ee06a7ad-231e-4077-a773-c6319661dfb6)


---

### What it does

- The workflow gathers the source markdown files of RFCs - approved
ones, and proposed ones (from open PRs).
- The proposed RFCs are separated into new (<7 days since PR created)
and stale (>30 days since PR updated).
- The RFCs are extended with a table of contents, and a link to the
source.
- The RFCs are build into a web page using
[mdBook](https://github.com/rust-lang/mdBook).
- The built web page gets pushed to `gh-pages` branch - to be published
in Github Pages.
- The workflow is triggered on merge to `main`, and periodically once a
day.
2024-01-03 20:05:00 +01:00

50 lines
1.4 KiB
YAML

name: mdBook
on:
push:
branches:
- main
schedule:
- cron: "0 0 * * *" # Once a day
jobs:
mdbook:
runs-on: ubuntu-latest
permissions:
# For writing to gh-pages branch.
contents: write
steps:
- name: Checkout this repo
uses: actions/checkout@v3
# Gather mdbook source files - approved (merged) files, and open PRs.
- name: Gather mdbook sources
uses: actions/github-script@v7
with:
script: |
const script = require('.github/scripts/gather-mdbook-sources.js')
await script({github, context})
- name: Build the mdbook SUMMARY.md
uses: actions/github-script@v7
with:
script: |
const script = require('.github/scripts/build-mdbook-summary.js')
await script({github, context})
- name: Setup mdBook binary
uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
with:
mdbook-version: '0.4.36'
- name: Install dependencies
run: |
cargo install mdbook-toc@0.14.1
- name: Generate the mdbook
run: |
cd mdbook
rm -rf ./book/
mdbook build --dest-dir ./book/
- name: Deploy to github pages
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
publish_dir: ./mdbook/book
github_token: ${{ secrets.GITHUB_TOKEN }}