name: build and deploy on: push: branches: - main - master workflow_dispatch: permissions: contents: write id-token: write pages: write jobs: build: runs-on: ubuntu-latest permissions: contents: read deployments: write if: github.event.repository.fork == false steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 sparse-checkout: | docs includes overrides tools - name: Setup Python runtime uses: actions/setup-python@v5 with: python-version: 3.x cache: pip cache-dependency-path: | pyproject.toml requirements.txt - name: Set PYTHONPATH run: echo "PYTHONPATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV - name: Restore build cache uses: actions/cache/restore@v4 with: key: mkdocs-material-${{ hashfiles('.cache/**') }} path: .cache restore-keys: | mkdocs-material- - run: sudo apt install pngquant - name: Install Python dependencies run: pip install -r requirements.txt - name: Install Insiders build if: github.event.repository.fork == false env: GH_TOKEN: ${{ secrets.GH_TOKEN }} run: | pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git - name: Build site run: | mkdocs build --clean mkdocs --version - name: Publish to Cloudflare Pages uses: cloudflare/pages-action@1 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} projectName: ${{ secrets.CLOUDFLARE_PAGES_PROJECT }} directory: 'site' gitHubToken: ${{ secrets.GITHUB_TOKEN }} - name: Save build cache uses: actions/cache/save@v4 with: key: mkdocs-material-${{ hashfiles('.cache/**') }} path: .cache