docs.yml
1 name: Deploy Docs 2 3 on: 4 push: 5 branches: [main] 6 paths: 7 - 'docs/**' 8 - 'mkdocs.yml' 9 - 'overrides/**' 10 - '.github/workflows/docs.yml' 11 - 'crates/auths-cli/src/**' 12 - 'crates/xtask/src/**' 13 pull_request: 14 branches: [main] 15 paths: 16 - 'docs/**' 17 - 'mkdocs.yml' 18 - 'overrides/**' 19 - 'crates/auths-cli/src/**' 20 - 'crates/xtask/src/**' 21 22 permissions: 23 contents: write 24 25 jobs: 26 check-cli-docs: 27 name: CLI docs up to date 28 runs-on: ubuntu-latest 29 steps: 30 - uses: actions/checkout@v4 31 32 - name: Install Rust toolchain 33 uses: dtolnay/rust-toolchain@stable 34 35 - name: Cache Rust build 36 uses: actions/cache@v4 37 with: 38 path: | 39 ~/.cargo/registry 40 ~/.cargo/git 41 target 42 key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} 43 restore-keys: ${{ runner.os }}-cargo- 44 45 - name: Check CLI docs are up to date 46 run: cargo run -p xtask -- gen-docs --check 47 48 deploy: 49 name: Deploy docs 50 needs: check-cli-docs 51 runs-on: ubuntu-latest 52 steps: 53 - uses: actions/checkout@v4 54 with: 55 fetch-depth: 0 # full history for git-revision-date 56 57 - uses: actions/setup-python@v5 58 with: 59 python-version: '3.12' 60 61 - name: Install dependencies 62 run: pip install mkdocs-material 63 64 - name: Build docs (PR check) 65 if: github.event_name == 'pull_request' 66 run: mkdocs build --strict 67 68 - name: Deploy to GitHub Pages 69 if: github.event_name == 'push' && github.ref == 'refs/heads/main' 70 run: mkdocs gh-deploy --force