Skip to content

Commit

Permalink
GHA: use cloudflare/wrangler-action
Browse files Browse the repository at this point in the history
  • Loading branch information
saltydk committed Oct 1, 2024
1 parent 4f6cbb0 commit b0da316
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 13 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/build-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,23 @@ jobs:

- name: Publish to Cloudflare Pages
id: cloudflare
uses: cloudflare/pages-action@v1.5.0
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: 86b9f680e99b6d172395cc7309a9d8a8
projectName: docs
directory: site
gitHubToken: ${{ secrets.GH_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: >
pages deploy site
--project-name=docs
--branch=${{
github.event.pull_request.head.repo.full_name == github.repository
&& (github.event.pull_request.head.ref || github.ref_name)
|| format('{0}/{1}',
github.event.pull_request.head.repo.full_name,
github.event.pull_request.head.ref)
}}
--commit-hash=${{
github.event.pull_request.head.sha || github.sha
}}
- name: Save build cache
id: cache-docs-save
Expand Down Expand Up @@ -100,7 +110,7 @@ jobs:

- name: Comment PR
run: |
PREVIEW_URL=${{ needs.build.outputs.url }}
PREVIEW_URL=${{ needs.build.outputs.deployment-url }}
BRANCH_PREVIEW_URL="https://pr-${{ github.event.inputs.pr_number }}.docs-acq.pages.dev"
BUILD_STATUS=${{ needs.build.result }}
Expand Down Expand Up @@ -139,5 +149,5 @@ jobs:
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ secrets.DISCORD_WEBHOOK }}
description: "URL: ${{ needs.build.outputs.url }}"
description: "URL: ${{ needs.build.outputs.deployment-url }}"
status: ${{ env.WORKFLOW_CONCLUSION }}
14 changes: 8 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-22.04
if: github.event.repository.fork == false && github.event_name != 'pull_request'
outputs:
url: ${{ steps.cloudflare.outputs.url }}
url: ${{ steps.cloudflare.outputs.deployment-url }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -85,13 +85,15 @@ jobs:
- name: Publish to Cloudflare Pages
if: github.event.repository.fork == false
id: cloudflare
uses: cloudflare/pages-action@v1.5.0
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_API_TOKEN }}
accountId: 86b9f680e99b6d172395cc7309a9d8a8
projectName: docs
directory: site
gitHubToken: ${{ secrets.GH_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
command: >
pages deploy site
--project-name=docs
--branch=main
--commit-hash=${{ github.sha }}
- name: Save build cache
id: cache-docs-save
Expand Down

0 comments on commit b0da316

Please sign in to comment.