Skip to content

Commit

Permalink
ci(docs): add GitHub Actions workflow for building and deploying docs
Browse files Browse the repository at this point in the history
- Create new workflow for generating and deploying documentation
  • Loading branch information
ShenMian committed Jan 23, 2025
1 parent 162eb4f commit 352bd9c
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Docs

on:
push:
branches: [main]

env:
CARGO_TERM_COLOR: always

permissions:
contents: read
pages: write
id-token: write

jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build docs
run: cargo doc --no-deps

- name: Add redirect
run: echo '<meta http-equiv="refresh" content="0;url=soukoban/index.html">' > target/doc/index.html

- name: Upload pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: target/doc

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

0 comments on commit 352bd9c

Please sign in to comment.