Skip to content

Commit adf63c9

Browse files
authored
Merge pull request #2185 from oasisprotocol/mz/wrangler
Migrate Cloudflare preview deploys to wrangler action
2 parents e59e90e + f69de4e commit adf63c9

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

.changelog/2185.internal.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrate Cloudflare preview deploys to wrangler action

.github/workflows/cloudflare-pages.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ jobs:
5656
run: yarn build
5757
- name: Publish to Cloudflare Pages
5858
# Id is needed to access output in a next step.
59-
id: cloudflare
60-
uses: cloudflare/pages-action@v1
59+
id: deploy
60+
uses: cloudflare/wrangler-action@v3
6161
with:
62+
# Token with Cloudflare Pages edit permission only generated in Cloudflare dashboard -> Manage Account -> Account API Tokens
6263
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
64+
# Acquired from Cloudflare dashboard -> Compute > Workers & Pages or dashboard url: https://dash.cloudflare.com/<account-id>/
6365
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
64-
# Project name created via Cloudflare dashboard.
65-
projectName: oasis-wallet
66-
# Use output directory of build command.
67-
directory: build
68-
branch: ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || '' }}
69-
wranglerVersion: '3'
66+
# Project created via Cloudflare dashboard or CLI command "npx wrangler pages project create <project-name>"
67+
command: pages deploy ./build --project-name=oasis-wallet --branch ${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || '' }}
7068
# On a subsequent run the original comment will be updated.
7169
- name: Update PR comment
7270
uses: mshick/add-pr-comment@v2
@@ -85,11 +83,11 @@ jobs:
8583
</tr>
8684
<tr>
8785
<td><strong>Preview URL:</strong></td>
88-
<td><a href="${{ steps.cloudflare.outputs.url }}">${{ steps.cloudflare.outputs.url }}</a></td>
86+
<td><a href="${{ steps.deploy.outputs.deployment-url }}">${{ steps.deploy.outputs.deployment-url }}</a></td>
8987
</tr>
9088
<tr>
9189
<td><strong>Alias:</strong></td>
92-
<td><a href="${{ steps.cloudflare.outputs.alias }}">${{ steps.cloudflare.outputs.alias }}</a></td>
90+
<td><a href="${{ steps.deploy.outputs.pages-deployment-alias-url }}">${{ steps.deploy.outputs.pages-deployment-alias-url }}</a></td>
9391
</tr>
9492
</table>
9593
message-failure: |

0 commit comments

Comments
 (0)