From 88d6e0709d8790f54f270f4962060b45e7354817 Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Mon, 6 Nov 2023 09:54:36 -0700 Subject: [PATCH 1/2] set up mdbook to publish via gh action --- .github/workflows/deploy-book.yaml | 65 ++++++++++++++++++++++++++++++ docs/.gitignore | 1 + docs/book.toml | 10 +++++ docs/src/SUMMARY.md | 4 ++ docs/src/how-to-update.md | 15 +++++++ docs/src/intro.md | 3 ++ 6 files changed, 98 insertions(+) create mode 100644 .github/workflows/deploy-book.yaml create mode 100644 docs/.gitignore create mode 100644 docs/book.toml create mode 100644 docs/src/SUMMARY.md create mode 100644 docs/src/how-to-update.md create mode 100644 docs/src/intro.md diff --git a/.github/workflows/deploy-book.yaml b/.github/workflows/deploy-book.yaml new file mode 100644 index 00000000..4d3a415c --- /dev/null +++ b/.github/workflows/deploy-book.yaml @@ -0,0 +1,65 @@ +name: Deploy mdBook site to Pages + +on: + # Runs on pushes targeting the default branch + push: + branches: ["main"] + paths: + - "docs/**" + - ".github/workflows/deploy-book.yaml" + pull_request: + branches: ["main"] + 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 diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 00000000..4e42a1bc --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +book/ \ No newline at end of file diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 00000000..bae0594b --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,10 @@ +[book] +authors = ["Chad Baker"] +language = "en" +multilingual = false +src = "src" +title = "FASTSim Documentation" + +[output.html.fold] +enable = true +level = 0 \ No newline at end of file diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 00000000..d19171dc --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,4 @@ +# Summary + +- [Introduction](./intro.md) +- [How to Update This Book](./how-to-update.md) diff --git a/docs/src/how-to-update.md b/docs/src/how-to-update.md new file mode 100644 index 00000000..65cf96d0 --- /dev/null +++ b/docs/src/how-to-update.md @@ -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/) diff --git a/docs/src/intro.md b/docs/src/intro.md new file mode 100644 index 00000000..1652ea2f --- /dev/null +++ b/docs/src/intro.md @@ -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. From 6580eb87b68a690499846d7e3b5552a73991f771 Mon Sep 17 00:00:00 2001 From: Chad Baker Date: Mon, 6 Nov 2023 09:59:57 -0700 Subject: [PATCH 2/2] fixed branch --- .github/workflows/deploy-book.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-book.yaml b/.github/workflows/deploy-book.yaml index 4d3a415c..9ff9ea1c 100644 --- a/.github/workflows/deploy-book.yaml +++ b/.github/workflows/deploy-book.yaml @@ -3,12 +3,12 @@ name: Deploy mdBook site to Pages on: # Runs on pushes targeting the default branch push: - branches: ["main"] + branches: ["fastsim-2"] paths: - "docs/**" - ".github/workflows/deploy-book.yaml" pull_request: - branches: ["main"] + branches: ["fastsim-2"] paths: - "docs/**" - ".github/workflows/deploy-book.yaml"