Testing PR deployment #3
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy PR to Cloudflare Pages | |
env: | |
base_url: test.quexeky.dev | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
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 -e 's/BASE_URL/https:\/\/rough-math-f97a.${{ env.base_url }}/' 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/[email protected] | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
projectName: rough-math-f97a | |
directory: build | |
outputs: | |
previewUrl: ${{ steps.deploy.outputs.preview_url }} | |