Skip to content

Instantly share code, notes, and snippets.

@wyatt-herkamp
Created October 13, 2023 16:35
Show Gist options
  • Save wyatt-herkamp/9fa02048115877cd44e0e7c18e3578ae to your computer and use it in GitHub Desktop.
Save wyatt-herkamp/9fa02048115877cd44e0e7c18e3578ae to your computer and use it in GitHub Desktop.
on:
push:
branches:
- main
workflow_dispatch:
name: Deploy Documentation
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
name: Deploy Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Rust Doc
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
components: rust-docs
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'
- run: mdbook build docs --dest-dir ../_site
- name: Run Cargo Doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --lib --no-deps --target-dir ./_site/
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Fix permissions
run: |
chmod -c -R +rX "_site/" | while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment