Skip to content

Commit

Permalink
Merge pull request #67 from NREL/mdbook-via-gh-action
Browse files Browse the repository at this point in the history
Mdbook via gh action
  • Loading branch information
calbaker authored Nov 6, 2023
2 parents 7655b39 + 6580eb8 commit 689b0e9
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 0 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/deploy-book.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Deploy mdBook site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["fastsim-2"]
paths:
- "docs/**"
- ".github/workflows/deploy-book.yaml"
pull_request:
branches: ["fastsim-2"]
paths:
- "docs/**"
- ".github/workflows/deploy-book.yaml"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: [ self-hosted ]
env:
MDBOOK_VERSION: 0.4.21
steps:
- uses: actions/checkout@v3
- name: Install mdBook
run: |
curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf -y | sh
rustup update
cargo install --version ${MDBOOK_VERSION} mdbook
- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
- name: Build with mdBook
working-directory: ${{runner.workspace}}/mbap-computing/docs/
run: mdbook build
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: ./docs/book

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: [ self-hosted ]
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
book/
10 changes: 10 additions & 0 deletions docs/book.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[book]
authors = ["Chad Baker"]
language = "en"
multilingual = false
src = "src"
title = "FASTSim Documentation"

[output.html.fold]
enable = true
level = 0
4 changes: 4 additions & 0 deletions docs/src/SUMMARY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Summary

- [Introduction](./intro.md)
- [How to Update This Book](./how-to-update.md)
15 changes: 15 additions & 0 deletions docs/src/how-to-update.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# How to Update This Markdown Book

[mdBook Documentation](https://rust-lang.github.io/mdBook/)

## Setup

1. If not already done, [install mdbook](https://rust-lang.github.io/mdBook/guide/installation.html)

## Publishing

1. Update `book.toml` or files in `docs/src/`
1. Make sure the docs look good locally: `mdbook build docs/ --open`
1. Commit files and push to `main` branch

After that, a GitHub action will build the book and publish it [here](https://pages.github.nrel.gov/MBAP/mbap-computing/)
3 changes: 3 additions & 0 deletions docs/src/intro.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Introduction

This is the overall FASTSim documentation. We're working toward making this a fully integrated document that includes both the Python API and Rust core documentation for the `fastsim-2` branch and eventually also for the `fastsim-3` branch.

0 comments on commit 689b0e9

Please sign in to comment.