Status

Since TinaCMS makes a git push on every change, it will also trigger a Cloudflare Pages build and before you know it, you have reached the free plan limits. So, I disabled automatic builds and created a deployment hook that I would manually trigger from the TinaCMS dashboard whenever I wanted to publish something.

The manual deployment hook works but it’s a pain to do it manually every time, so I decided to optimize this step with GitHub Actions!

This simple GH Action will trigger the deployment hook whenever something in the /content directory changes.

name: Publish to Cloudflare Pages

on:
  push:
    branches:
      - master
    paths:
      - 'content/**'

jobs:
  publish:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Trigger deployment
        env:
          PAGES_HOOK_ID: ${{ secrets.CLOUDFLARE_HOOK_ID }}
        run: |
          curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/$PAGES_HOOK_ID"
22:09 (+0200)
Cavallino-Treporti, Italy
27°C