Merge pull request #20 from louistrue/docs #27
This file contains hidden or 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 Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - 'rust/**' | |
| - '.github/workflows/docs.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements-docs.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip- | |
| - name: Cache Cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-cargo- | |
| - name: Install dependencies | |
| run: pip install -r requirements-docs.txt | |
| - name: Build MkDocs | |
| run: mkdocs build --strict | |
| - name: Build Rustdoc | |
| run: cargo doc --no-deps --workspace | |
| continue-on-error: true | |
| - name: Copy Rustdoc to site | |
| if: success() || failure() | |
| run: | | |
| if [ -d "target/doc" ]; then | |
| mkdir -p site/api/rust | |
| cp -r target/doc/* site/api/rust/ | |
| fi | |
| - name: Create .nojekyll file | |
| run: touch site/.nojekyll | |
| - name: Verify site structure | |
| run: | | |
| echo "Site directory contents:" | |
| ls -la site/ | head -20 | |
| echo "" | |
| echo "Checking for index.html:" | |
| ls -la site/index.html || echo "index.html not found!" | |
| echo "" | |
| echo "Site directory size:" | |
| du -sh site/ | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |