Document method overloading rules and improve docs on binding commands in general #457
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.avaloniaui.net CI/CD | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| concurrency: | |
| group: deploy-docs-avaloniaui-net-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| name: Build and Deploy | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build || true | |
| - name: Verify build output | |
| run: | | |
| if [ ! -f build/index.html ]; then | |
| echo "ERROR: build/index.html not found" | |
| exit 1 | |
| fi | |
| echo "Build size: $(du -sh build | cut -f1)" | |
| - name: Install rclone | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| run: | | |
| curl -fsSL https://rclone.org/install.sh | sudo bash | |
| rclone version | |
| - name: Upload hashed assets (immutable cache) | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| env: | |
| RCLONE_CONFIG_SCALEWAY_TYPE: s3 | |
| RCLONE_CONFIG_SCALEWAY_PROVIDER: Scaleway | |
| RCLONE_CONFIG_SCALEWAY_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY_ID }} | |
| RCLONE_CONFIG_SCALEWAY_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_ACCESS_KEY }} | |
| RCLONE_CONFIG_SCALEWAY_ENDPOINT: s3.fr-par.scw.cloud | |
| RCLONE_CONFIG_SCALEWAY_REGION: fr-par | |
| RCLONE_CONFIG_SCALEWAY_ACL: public-read | |
| run: | | |
| rclone sync build/assets/ scaleway:docs.avaloniaui.net/assets/ \ | |
| --header-upload "Cache-Control: public, max-age=31536000, immutable" \ | |
| --s3-acl public-read \ | |
| --verbose | |
| - name: Upload remaining files (short cache) | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| env: | |
| RCLONE_CONFIG_SCALEWAY_TYPE: s3 | |
| RCLONE_CONFIG_SCALEWAY_PROVIDER: Scaleway | |
| RCLONE_CONFIG_SCALEWAY_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY_ID }} | |
| RCLONE_CONFIG_SCALEWAY_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_ACCESS_KEY }} | |
| RCLONE_CONFIG_SCALEWAY_ENDPOINT: s3.fr-par.scw.cloud | |
| RCLONE_CONFIG_SCALEWAY_REGION: fr-par | |
| RCLONE_CONFIG_SCALEWAY_ACL: public-read | |
| run: | | |
| rclone sync build/ scaleway:docs.avaloniaui.net/ \ | |
| --exclude "assets/**" \ | |
| --header-upload "Cache-Control: public, max-age=300, s-maxage=3600" \ | |
| --s3-acl public-read \ | |
| --verbose | |
| - name: Verify deployment | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| run: | | |
| HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://docs.avaloniaui.net.s3-website.fr-par.scw.cloud) | |
| if [ "$HTTP_STATUS" = "200" ]; then | |
| echo "Verification passed (HTTP $HTTP_STATUS)" | |
| else | |
| echo "WARNING: Website returned HTTP $HTTP_STATUS" | |
| exit 1 | |
| fi | |
| - name: Generate KV redirect entries | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| working-directory: redirects/cloudflare_worker_kv_redirects | |
| run: node generate-kv-redirects.mjs | |
| - name: Validate KV redirects | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| run: | | |
| ENTRY_COUNT=$(python3 -c "import json; print(len(json.load(open('redirects/kv-redirects.json'))))") | |
| echo "Redirect entries: $ENTRY_COUNT" | |
| # Sanity check: all targets must be https URLs on known domains | |
| SUSPECT=$(python3 -c " | |
| import json, sys | |
| data = json.load(open('redirects/kv-redirects.json')) | |
| allowed = ['https://docs.avaloniaui.net', 'https://github.com/AvaloniaUI'] | |
| bad = [e for e in data if not any(e['value'].startswith(p) for p in allowed)] | |
| for e in bad: | |
| print(f\" UNEXPECTED TARGET: {e['key']} -> {e['value']}\") | |
| sys.exit(1 if bad else 0) | |
| ") | |
| if [ $? -ne 0 ]; then | |
| echo "::error::KV redirects contain targets outside allowed domains" | |
| echo "$SUSPECT" | |
| exit 1 | |
| fi | |
| echo "All redirect targets are on allowed domains" | |
| - name: Upload redirects to Cloudflare KV | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: | | |
| npx wrangler kv bulk put redirects/kv-redirects.json \ | |
| --namespace-id ae8131374b0d409e9ab0537882dafe0b \ | |
| --remote | |
| - name: Purge Cloudflare edge cache | |
| if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| run: | | |
| curl -sf -X POST \ | |
| "https://api.cloudflare.com/client/v4/zones/aaa9cb3f1e40e56edad4ceba5226d0e0/purge_cache" \ | |
| -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \ | |
| -H "Content-Type: application/json" \ | |
| --data '{"hosts":["docs.avaloniaui.net"]}' |