Skip to content

Commit 3d37cbe

Browse files
committed
Deploy to Cloudflare Pages instead of Netlify
1 parent 58ea0a5 commit 3d37cbe

4 files changed

Lines changed: 20 additions & 29 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -43,33 +43,21 @@ jobs:
4343
- name: Render site
4444
run: uv run python render.py Examples.build.ipynb
4545

46-
- name: Deploy to Netlify (Production)
46+
- name: Deploy to Cloudflare Pages (Production)
4747
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
48-
uses: nwtgck/actions-netlify@v3
48+
uses: cloudflare/wrangler-action@v3
4949
with:
50-
publish-dir: ./web
51-
production-deploy: true
52-
github-token: ${{ secrets.GITHUB_TOKEN }}
53-
deploy-message: "Deploy from GitHub Actions - ${{ github.event.head_commit.message }}"
54-
enable-pull-request-comment: false
55-
enable-commit-comment: false
56-
env:
57-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
58-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
50+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
51+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
52+
command: pages deploy web --project-name=pythonplot --branch=main
5953

60-
- name: Deploy to Netlify (Preview)
54+
- name: Deploy to Cloudflare Pages (Preview)
6155
if: github.ref != 'refs/heads/master'
62-
uses: nwtgck/actions-netlify@v3
56+
uses: cloudflare/wrangler-action@v3
6357
with:
64-
publish-dir: ./web
65-
production-deploy: false
66-
github-token: ${{ secrets.GITHUB_TOKEN }}
67-
deploy-message: "Preview deploy from GitHub Actions"
68-
enable-pull-request-comment: true
69-
enable-commit-comment: false
70-
env:
71-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
72-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
58+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
59+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
60+
command: pages deploy web --project-name=pythonplot --branch=${{ github.head_ref || github.ref_name }}
7361

7462
- name: Upload build artifacts
7563
if: always()

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,3 @@ Examples.*.ipynb
44
.setup_done
55
.venv/
66
__pycache__/
7-
# Local Netlify folder
8-
.netlify

CLAUDE.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@ GitHub Actions (`.github/workflows/deploy.yml`) on every push:
128128
3. `uv run kaleido_get_chrome`
129129
4. Run pytest
130130
5. Execute notebook and render site
131-
6. Deploy to Netlify: production on master pushes, preview otherwise
131+
6. Deploy `web/` to Cloudflare Pages (project `pythonplot`, direct upload via `cloudflare/wrangler-action`)
132132

133-
**Required Secrets:** `NETLIFY_AUTH_TOKEN`, `NETLIFY_SITE_ID`
133+
Master pushes deploy with `--branch=main`, which the Cloudflare project treats as its
134+
production branch (pythonplot.com, www.pythonplot.com). Every other branch deploys with
135+
its own branch name, producing a preview URL.
136+
137+
**Required Secrets:** `CLOUDFLARE_API_TOKEN` (needs the Cloudflare Pages: Edit
138+
permission), `CLOUDFLARE_ACCOUNT_ID`

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,6 @@ cd web && python -m http.server
122122
#### CI/CD
123123

124124
The project uses GitHub Actions for continuous integration and deployment:
125-
- **Pushes to `master`**: Automatically deployed to production on Netlify
126-
- **Other branches**: Create preview deployments on Netlify
127-
- Requires secrets: `NETLIFY_AUTH_TOKEN` and `NETLIFY_SITE_ID`
125+
- **Pushes to `master`**: Deployed to production on the Cloudflare Pages project `pythonplot`
126+
- **Other branches**: Create preview deployments on Cloudflare Pages
127+
- Requires secrets: `CLOUDFLARE_API_TOKEN` and `CLOUDFLARE_ACCOUNT_ID`

0 commit comments

Comments
 (0)