Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/cloudflare-pr-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Deploy PR to Cloudflare Pages

on:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
# Build and deploy the preview.
deploy-preview:
runs-on: ubuntu-latest
name: Deploy to Cloudflare Pages
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: yarn
- name: Get PR number
id: pr_number
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV
- name: Configure Docusaurus for PR deploy
run: sed -i 's/BASE_URL/${{ env.PR_NUMBER }}' docusaurus.config.ts

- name: Install dependencies
run: yarn install --frozen-lockfile

- name: Build
run: yarn build

- name: Deploy to Cloudflare Pages
id: deploy
uses: cloudflare/wrangler-action@v3.14.1
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy build --project-name=${{ env.PR_NUMBER }}


outputs:
previewUrl: https://${{ env.PR_NUMBER }}.test.quexeky.dev

2 changes: 1 addition & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const config: Config = {
favicon: "/drop.svg",

// Set the production url of your site here
url: "https://docs.droposs.org",
url: "BASE_URL",
// Set the /<baseUrl>/ pathname under which your site is served
// For GitHub pages deployment, it is often '/<projectName>/'
baseUrl: "/",
Expand Down
Loading