Skip to content

Commit

Permalink
Add workflow for github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuris committed Sep 7, 2023
1 parent 3f51676 commit e76a031
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
toolchain: stable
override: true
- uses: arduino/setup-protoc@v2
# caution: this is the same restore as in gh-pages.yaml
- name: Restore Cargo Cache
id: cargo-cache
uses: actions/cache/restore@v3
Expand Down Expand Up @@ -175,3 +176,8 @@ jobs:
target/
key: ${{ needs.build.outputs.cache-key }}
- run: RUSTDOCFLAGS="-D warnings" cargo doc --all --document-private-items --no-deps
- run: |
git clean -f docs
echo "<meta http-equiv=\"refresh\" content=\"0; url=firewood\">" > target/doc/index.html
echo "copying documentation to doc..."
cp -r target/doc ./docs
80 changes: 80 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: gh-pages

on:
push:
branches:
- "main"
- "doc-debug"
- "rkuris/doc-it-hurts-when-i-do-this"

env:
CARGO_TERM_COLOR: always

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- uses: arduino/setup-protoc@v2
# caution: this is the same restore as in ci.yaml
- name: Restore Cargo Cache
id: cargo-cache
uses: actions/cache/restore@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
# We can do this now because we use specific verison and update with Dependabot
# but if we make the deps any less specifc, we'll have to fix
key: ${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}-${{ hashFiles('**/*.rs') }}
# start from the previous set of cached dependencies
restore-keys: |
${{ runner.os }}-deps-${{ hashFiles('**/Cargo.toml') }}-
${{ runner.os }}-deps-
- name: Build
run: cargo doc --no-deps
- name: Set up _site redirect to firewood
run: |
rm -fr _site
mkdir _site
echo "<meta http-equiv=\"refresh\" content=\"0; url=firewood\">" > _site/index.html
- name: Copy doc files to _site
run: |
cp -rv target/doc/* ./_site
cp -rv docs/assets ./_site
- uses: actions/upload-artifact@v3
with:
name: pages
path: _site
if-no-files-found: error
deploy:
needs: build
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Download pages artifact
uses: actions/download-artifact@v3
with:
name: pages
path: .
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: .
- name: Deploy to GitHub pages
id: deployment
uses: actions/deploy-pages@v2

0 comments on commit e76a031

Please sign in to comment.