Merge pull request #32 from Johnabell/fix-documentation-workflow #8
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: Deploy Crate Documentation | |
on: | |
push: | |
branches: ["master"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
env: | |
DOC_DIR: ./doc | |
jobs: | |
deploy: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Build docs | |
run: | | |
cargo doc --document-private-items | |
rm -rf $DOC_DIR | |
echo "<meta http-equiv=\"refresh\" content=\"0; url=tiptop\">" > target/doc/index.html | |
cp -r target/doc $DOC_DIR | |
- name: Fix file permissions | |
# To fix file permissions issue: https://github.com/actions/deploy-pages/issues/188 | |
run: chmod -c -R +rX $DOC_DIR | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
# Upload entire repository | |
path: ${{ env.DOC_DIR }} | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |