forked from theseus-os/Theseus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions workflow to build and deploy documentation. (these…
- Loading branch information
Showing
7 changed files
with
135 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Documentation | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
documentation: | ||
name: Build and deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository and submodules | ||
uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Cache build artifacts | ||
uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
${{ runner.os }}- | ||
# Remove documentation directory cache before publishing. | ||
- name: Clean source documentation directory before publishing | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main' | ||
run: cargo clean --doc | ||
|
||
- name: Install mdbook | ||
uses: peaceiris/actions-mdbook@v1 | ||
with: | ||
mdbook-version: '0.4.10' | ||
|
||
- name: Install mdbook-linkcheck | ||
run: | | ||
version="v0.7.4" | ||
file="mdbook-linkcheck" | ||
zip_file="mdbook-linkcheck.${version}.x86_64-unknown-linux-gnu.zip" | ||
curl -sSL https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/${version}/${zip_file} --output ${zip_file} | ||
unzip -d bin ${zip_file} ${file} | ||
chmod +x bin/${file} | ||
rm ${zip_file} | ||
echo "$(pwd)/bin" >> ${GITHUB_PATH} | ||
- name: Report versions | ||
run: | | ||
rustc --version --verbose | ||
mdbook --version | ||
mdbook-linkcheck --version | ||
- name: Build book | ||
run: make book | ||
|
||
- name: Build source documentation | ||
run: make doc | ||
|
||
# Move build artifacts to publish directory on push to main branch. | ||
- name: Move build artifacts | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main' | ||
run: | | ||
rm -rf ./github_pages/book | ||
rm -rf ./github_pages/doc | ||
mv ./build/book/html/ ./github_pages/book/ | ||
mv ./build/doc/ ./github_pages/doc/ | ||
# Deploy on push to main branch. | ||
- name: Deploy | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/theseus_main' | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
commit_message: ${{ github.event.head_commit.message }} | ||
publish_branch: github_pages | ||
publish_dir: ./github_pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Specify any content here to exclude it from GitHub Pages. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Published Documentation | ||
|
||
This directory contains files used to publish Theseus's documentation online, which is realized using GitHub Pages at [https://theseus-os.github.io/Theseus](https://theseus-os.github.io/Theseus). | ||
|
||
Any file in this directory is included in the published output (e.g., `index.html`), unless it is explicitly added to the local `.gitignore` file here. | ||
|
||
## Automatically Generated Directories | ||
|
||
When building Theseus's book and source code documentation (rustdoc) automtically using GitHub Actions, the `book/` and `doc/` directories are generated here. Those directories are ignored by git in the top-level `.gitignore` file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<!DOCTYPE html> | ||
<html lang="en-US"> | ||
|
||
<h1>Theseus Documentation</h1> | ||
|
||
<p>Welcome to the online docs for Theseus! There are two kinds of docs available: </p> | ||
<ul> | ||
<li> <a href="./doc/___Theseus_Crates___/index.html">Source-level documentation</a> (rustdoc) </li> | ||
<li> The <a href="./book/index.html">Theseus Book</a>, a higher-level overview of Theseus design concepts. </li> | ||
</ul> | ||
|
||
<p>You can also check out the main Theseus <a href="https://github.com/theseus-os/Theseus/blob/theseus_main/README.md">README</a> file for a quick start guide. </p> |