Sync Ezoic revenue stats #505
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: Deploy Cloudflare Pages mirror | |
| # Keeps a full static copy of the site on Cloudflare Pages (a completely | |
| # separate hosting provider from GitHub Pages), as a failover if GitHub Pages | |
| # itself ever goes down. Runs on every push to main and can be re-run | |
| # manually. | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checking out source code | |
| uses: actions/checkout@v4 | |
| - name: Build a clean copy (exclude repo/CI-only dirs) | |
| run: | | |
| mkdir -p /tmp/pages-mirror | |
| rsync -a --exclude='.git' --exclude='.github' --exclude='cloudflare' --exclude='.DS_Store' \ | |
| ./ /tmp/pages-mirror/ | |
| - name: Deploy to Cloudflare Pages | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CF_ACCOUNT_ID }} | |
| run: | | |
| # Cloudflare's API occasionally blips; retry a few times before | |
| # actually failing the run instead of paging over a one-off. | |
| for attempt in 1 2 3; do | |
| npx wrangler pages deploy /tmp/pages-mirror --project-name=pearos-mirror --branch=main && exit 0 | |
| echo "Attempt $attempt failed, retrying in 30s..." | |
| sleep 30 | |
| done | |
| exit 1 |