Skip to content
This repository was archived by the owner on Jan 6, 2026. It is now read-only.

Commit c9b8b32

Browse files
authored
ci: move daily deployments to Cloudflare (#42)
Rework the Cron GitHub actions to stop running the build by GitHub and trigger a new deployment on Cloudflare instead. This removes the inconsistency between pull request previews and cron deployments, where pull request previews were built by Cloudflare while cron deployments were built on GitHub. Additional changes: - Remove the GHA trigger for the main branch. The Cloudflare integration already watches the main branch and creates new deployments after a new commit was pushed. - Add manual trigger to allow us to test the functionality of this workflow or to manually re-run it after failures. Signed-off-by: Miroslav Bajtoš <oss@bajtos.net>
1 parent eef8e1d commit c9b8b32

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

.github/workflows/deploy.yml

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: Deploy Observable Dashboard to Cloudflare Pages
1+
name: Trigger Cloudflare Pages Deployment
22

33
on:
4-
push:
5-
branches: [main]
64
schedule:
75
- cron: '0 4 * * *'
6+
workflow_dispatch:
87

98
concurrency:
109
group: ${{ github.workflow }}-${{ github.ref }}
@@ -25,24 +24,15 @@ jobs:
2524
- name: Install Node.js
2625
uses: actions/setup-node@v4
2726
with:
28-
node-version: 20
27+
node-version: 22
2928
cache: npm
3029

31-
- name: Install dependencies
32-
run: npm ci
33-
34-
- name: Build project
35-
run: npm run build # Assumes your project has a build script in package.json
36-
env:
37-
API_TOKEN: ${{ secrets.API_TOKEN }}
38-
39-
- name: Deploy to Cloudflare Pages
40-
uses: cloudflare/pages-action@v1
41-
with:
42-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
43-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
44-
projectName: spark-dashboard # Replace with your Cloudflare Pages project name
45-
directory: ./dist # Replace with your output directory after build
30+
- name: Trigger a new Cloudflare Pages deployment
31+
run: |
32+
curl --fail-with-body -X POST \
33+
-H "Authorization: Bearer {{ secrets.CLOUDFLARE_API_TOKEN }}" \
34+
-H "Content-Type: application/json" \
35+
https://api.cloudflare.com/client/v4/accounts/{{ secrets.CLOUDFLARE_ACCOUNT_ID }}/pages/projects/spark-dashboard/deployments
4636
4737
- if: failure()
4838
uses: slackapi/slack-github-action@v2.0.0

0 commit comments

Comments
 (0)