Skip to content

Commit 8713854

Browse files
committed
update Cloudflare Pages configuration and workflow for project name and deployment process
1 parent e2c7be6 commit 8713854

2 files changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/deploy-cloudflare-pages.yml

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,16 @@ on:
44
push:
55
branches:
66
- main
7-
- master
87
pull_request:
98
branches:
109
- main
11-
- master
1210

1311
jobs:
1412
deploy:
1513
runs-on: ubuntu-latest
1614
name: Deploy to Cloudflare Pages
1715
permissions:
1816
contents: read
19-
deployments: write
2017
steps:
2118
- name: Checkout
2219
uses: actions/checkout@v4
@@ -73,13 +70,23 @@ jobs:
7370
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
7471
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
7572

76-
- name: Deploy to Cloudflare Pages
77-
uses: cloudflare/pages-action@v1
78-
with:
79-
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
80-
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
81-
projectName: party
82-
directory: packages/playground/dist
83-
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
84-
wranglerVersion: '3'
73+
- name: Deploy to Cloudflare Pages (preview)
74+
if: github.event_name == 'pull_request'
75+
env:
76+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
77+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
78+
run: |
79+
wrangler pages deploy packages/playground/dist \
80+
--project-name party \
81+
--branch "pr-${{ github.event.pull_request.number }}"
82+
83+
- name: Deploy to Cloudflare Pages (production)
84+
if: github.event_name == 'push'
85+
env:
86+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
87+
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
88+
run: |
89+
wrangler pages deploy packages/playground/dist \
90+
--project-name party \
91+
--branch "${{ github.ref_name }}"
8592

cloudflare-pages-config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ If you prefer to configure via Cloudflare Pages dashboard instead of GitHub Acti
3636

3737
## Project Name
3838

39-
The workflow uses `party-playground` as the project name. If you use a different name in Cloudflare Pages, update the `projectName` in `.github/workflows/deploy-cloudflare-pages.yml`.
39+
The workflow uses `party` as the project name. If you use a different name in Cloudflare Pages, update the `--project-name` value in `.github/workflows/deploy-cloudflare-pages.yml`.
4040

0 commit comments

Comments
 (0)