add docs #16
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
name: Build and Deploy to GitHub Pages | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Install libclang | |
run: sudo apt-get install -y libclang-dev | |
- name: Set up Rust | |
uses: moonrepo/setup-rust@v1 | |
with: | |
rust-version: stable | |
- name: Cache Cargo registry | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cargo/registry | |
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-registry- | |
- name: Cache Cargo build | |
uses: actions/cache@v3 | |
with: | |
path: target | |
key: ${{ runner.os }}-cargo-target-${{ hashFiles('**/Cargo.toml') }} | |
restore-keys: | | |
${{ runner.os }}-cargo-target- | |
- name: Build the project | |
run: cargo build --release | |
- name: Run Cargo project in 'example' directory | |
run: | | |
cd example | |
cargo run --release build | |
- name: Deploy docs to GitHub Pages | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
branch: gh-pages | |
folder: example/docs | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Clean up | |
run: | | |
rm -rf example/docs |