| 1 | on: |
| 2 | workflow_dispatch: |
| 3 | push: |
| 4 | branches: |
| 5 | - main |
| 6 | |
| 7 | name: Documentation |
| 8 | |
| 9 | jobs: |
| 10 | deploy-docs: |
| 11 | concurrency: deploy-docs |
| 12 | runs-on: ubuntu-latest |
| 13 | steps: |
| 14 | - name: Checkout |
| 15 | uses: actions/checkout@v3 |
| 16 | with: |
| 17 | submodules: recursive |
| 18 | |
| 19 | - name: Toolchain |
| 20 | uses: dtolnay/rust-toolchain@stable |
| 21 | |
| 22 | - name: Cache |
| 23 | uses: Swatinem/rust-cache@v2 |
| 24 | |
| 25 | - name: Clean docs-gh dir |
| 26 | run: rm -rf docs-gh |
| 27 | shell: bash |
| 28 | |
| 29 | - name: Clean Rust docs dir |
| 30 | run: cargo clean --manifest-path ./Cargo.toml --doc |
| 31 | |
| 32 | - name: Build Rust docs |
| 33 | run: cargo doc --manifest-path ./Cargo.toml --all-features --no-deps |
| 34 | |
| 35 | - name: Move Rust docs |
| 36 | run: mkdir -p docs-gh && mv target/doc/* docs-gh/. |
| 37 | shell: bash |
| 38 | |
| 39 | - name: Configure root page |
| 40 | run: echo '<meta http-equiv="refresh" content="0; url=ink_stroke_modeler_rs/index.html">' > docs-gh/index.html |
| 41 | |
| 42 | - name: Deploy docs-gh |
| 43 | uses: peaceiris/actions-gh-pages@v3 |
| 44 | with: |
| 45 | github_token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | publish_dir: ./docs-gh |