Skip to content

Commit a72e0a1

Browse files
committed
Enable deployment to Cloudflare Workers with Github Actions
1 parent 0b6e899 commit a72e0a1

File tree

3 files changed

+27
-47
lines changed

3 files changed

+27
-47
lines changed

.github/workflows/beta_deploy.yml

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,13 @@ jobs:
1818
build-deploy:
1919
runs-on: ubuntu-latest
2020
steps:
21-
2221
- name: Checkout your repository using git
2322
uses: actions/checkout@v4
24-
25-
- name: Install, build, and upload your site output
26-
env:
27-
NODE_OPTIONS: "--max_old_space_size=4096"
28-
uses: withastro/action@v2
29-
30-
- name: Deploy to Netlify
31-
uses: nwtgck/actions-netlify@v3.0
23+
- name: Build website
24+
run: npm run build
25+
- name: Deploy to Cloudflare Workers
26+
uses: cloudflare/wrangler-action@v3
3227
with:
33-
publish-dir: './dist'
34-
production-branch: "2.0"
35-
github-token: ${{ secrets.GITHUB_TOKEN }}
36-
deploy-message: "Deploy from GitHub Actions"
37-
enable-pull-request-comment: false
38-
enable-commit-comment: false
39-
overwrites-pull-request-comment: false
40-
env:
41-
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
42-
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
28+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
29+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
30+
environment: beta

.github/workflows/deploy.yml

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,15 @@ permissions:
1515
id-token: write
1616

1717
jobs:
18-
build:
18+
build-deploy:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: Checkout your repository using git
2222
uses: actions/checkout@v4
23-
- name: Install, build, and upload your site output
24-
env:
25-
NODE_OPTIONS: "--max_old_space_size=4096"
26-
uses: withastro/action@v2
27-
28-
deploy:
29-
needs: build
30-
runs-on: ubuntu-latest
31-
environment:
32-
name: github-pages
33-
url: ${{ steps.deployment.outputs.page_url }}
34-
steps:
35-
- name: Deploy to GitHub Pages
36-
id: deployment
37-
uses: actions/deploy-pages@v4
23+
- name: Build website
24+
run: npm run build
25+
- name: Deploy to Cloudflare Workers
26+
uses: cloudflare/wrangler-action@v3
27+
with:
28+
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
29+
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}

wrangler.jsonc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
"observability": {
77
"enabled": true
88
},
9-
// "routes": [
10-
// {
11-
// "pattern": "p5js.org",
12-
// "custom_domain": true
13-
// }
14-
// ],
9+
"routes": [
10+
{
11+
"pattern": "p5js.org",
12+
"custom_domain": true
13+
}
14+
],
1515
"compatibility_flags": [
1616
"global_fetch_strictly_public",
1717
"nodejs_compat"
@@ -21,12 +21,12 @@
2121
},
2222
"env": {
2323
"beta": {
24-
// "routes": [
25-
// {
26-
// "pattern": "beta.p5js.org",
27-
// "custom_domain": true
28-
// }
29-
// ]
24+
"routes": [
25+
{
26+
"pattern": "beta.p5js.org",
27+
"custom_domain": true
28+
}
29+
]
3030
}
3131
}
3232
}

0 commit comments

Comments
 (0)