name: Deploy rust docs
on:
push:
branches: ["master"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy_docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build docs
run: cargo doc --lib --no-deps -p ezcache --target-dir target --all-features
- name: Inject index.html
run: |
echo "<!DOCTYPE html>" > target/doc/index.html
# https://stackoverflow.com/questions/5302663/permanent-redirect-from-github-gh-pages
echo '<html><head><meta charset="utf8"><title>Redirecting...</title><link rel="canonical" href="ezcache"/><meta http-equiv="refresh" content="0;url=ezcache" /></head><body><h1>Redirecting...</h1><a href="ezcache">Click here if you are not redirected.<a><script>location+="/ezcache"</script></body></html>' >> target/doc/index.html
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: './target/doc' - name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4