Skip to content

Commit

Permalink
Add workflow for github pages (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
rkuris authored Sep 7, 2023
1 parent 3f51676 commit 6683a0f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .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 @@ -174,4 +175,4 @@ jobs:
~/.cargo/git/db/
target/
key: ${{ needs.build.outputs.cache-key }}
- run: RUSTDOCFLAGS="-D warnings" cargo doc --all --document-private-items --no-deps
- run: RUSTDOCFLAGS="-D warnings" cargo doc --document-private-items --no-deps
78 changes: 78 additions & 0 deletions .github/workflows/gh-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: gh-pages

on:
push:
branches:
- "main"

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 --document-private-items --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 6683a0f

Please sign in to comment.