Replace GA consent UI with privacy-first measurable analytics #280
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: Docs deployment | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'src/**' | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - 'pyproject.toml' | |
| - 'scripts/check-docs-analytics.py' | |
| - 'scripts/check-docs-layout.py' | |
| - '.github/workflows/docs.yml' | |
| - '.github/workflows/docs-pr.yml' | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: docs-deployment | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6 | |
| - uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6 | |
| with: | |
| python-version: "3.12" | |
| - name: Install package + docs deps | |
| run: pip install -e '.[docs]' | |
| - name: Install browser for responsive layout checks | |
| run: python -m playwright install --with-deps chromium | |
| - name: Build site | |
| env: | |
| CLOUDFLARE_WEB_ANALYTICS_TOKEN: ${{ vars.CLOUDFLARE_WEB_ANALYTICS_TOKEN }} | |
| run: | | |
| if [ "$GITHUB_SERVER_URL" = https://github.com ]; then | |
| if ! printf '%s' "$CLOUDFLARE_WEB_ANALYTICS_TOKEN" | grep -Eq '^[a-f0-9]{32}$'; then | |
| echo 'CLOUDFLARE_WEB_ANALYTICS_TOKEN must be the canonical 32-character site token' >&2 | |
| exit 1 | |
| fi | |
| sed -i "s/__CLOUDFLARE_WEB_ANALYTICS_TOKEN__/$CLOUDFLARE_WEB_ANALYTICS_TOKEN/" \ | |
| docs/javascripts/analytics.js | |
| fi | |
| mkdocs build --strict | |
| python scripts/check-docs-analytics.py site | |
| python scripts/check-docs-layout.py site | |
| - name: Upload GitHub Pages artifact | |
| if: ${{ github.server_url == 'https://github.com' }} | |
| uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5 | |
| with: | |
| path: site | |
| deploy: | |
| needs: build | |
| if: ${{ github.server_url == 'https://github.com' && github.ref == 'refs/heads/main' }} | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| pages: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5 |