From 00e860d8e687d2cd77f425b7ba77b3b591458127 Mon Sep 17 00:00:00 2001
From: Jacky Zhao <j.zhao2k19@gmail.com>
Date: Mon, 28 Apr 2025 20:19:29 +0000
Subject: [PATCH] ci: fix fork preview
---
.github/workflows/build-preview.yaml | 11 ++++-------
.github/workflows/deploy-preview.yaml | 37 +++++++++++++++++++++++++++++++++++++
2 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/.github/workflows/preview.yaml b/.github/workflows/build-preview.yaml
similarity index 72%
rename from .github/workflows/preview.yaml
rename to .github/workflows/build-preview.yaml
index 80a8a41..9a4455d 100644
--- a/.github/workflows/preview.yaml
+++ b/.github/workflows/build-preview.yaml
@@ -36,11 +36,8 @@
- name: Build Quartz
run: npx quartz build -d docs -v
- - name: Publish to Cloudflare Pages
- uses: AdrianGonz97/refined-cf-pages-action@v1
+ - name: Upload build artifact
+ uses: actions/upload-artifact@v4
with:
- apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
- githubToken: ${{ secrets.GITHUB_TOKEN }}
- projectName: quartz
- directory: public
+ name: preview-build
+ path: public
diff --git a/.github/workflows/deploy-preview.yaml b/.github/workflows/deploy-preview.yaml
new file mode 100644
index 0000000..20a9ac3
--- /dev/null
+++ b/.github/workflows/deploy-preview.yaml
@@ -0,0 +1,37 @@
+name: Upload Preview Deployment
+on:
+ workflow_run:
+ workflows: ["Build Preview Deployment"]
+ types:
+ - completed
+
+permissions:
+ actions: read
+ deployments: write
+ contents: read
+ pull-requests: write
+
+jobs:
+ deploy-preview:
+ if: ${{ github.repository == 'jackyzha0/quartz' && github.event.workflow_run.conclusion == 'success' }}
+ runs-on: ubuntu-latest
+ name: Deploy Preview to Cloudflare Pages
+ steps:
+ - name: Download build artifact
+ uses: actions/download-artifact@v4
+ id: preview-build-artifact
+ with:
+ name: preview-build
+ path: build
+ github-token: ${{ secrets.GITHUB_TOKEN }}
+ run-id: ${{ github.event.workflow_run.id }}
+
+ - name: Deploy to Cloudflare Pages
+ uses: AdrianGonz97/refined-cf-pages-action@v1
+ with:
+ apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
+ accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
+ githubToken: ${{ secrets.GITHUB_TOKEN }}
+ projectName: YOUR_PROJECT_NAME
+ deploymentName: Preview
+ directory: ${{ steps.preview-build-artifact.outputs.download-path }}
--
Gitblit v1.10.0