From 667e2599f50be60422c475d22762e2d0b141b287 Mon Sep 17 00:00:00 2001 From: Xi Xu Date: Tue, 18 Nov 2025 20:41:09 +0800 Subject: [PATCH] Add workflows for Cloudflare and EdgeOne Pages deployment Introduces separate GitHub Actions workflows for deploying to Cloudflare Pages and EdgeOne Pages. Also renames and updates the existing deploy workflow to workers.yml, reduces its timeout, and clarifies step names for Cloudflare Workers deployment. --- .github/workflows/pages-cf.yml | 32 +++++++++++++++ .github/workflows/pages-eo.yml | 40 +++++++++++++++++++ .github/workflows/{deploy.yml => workers.yml} | 8 ++-- 3 files changed, 77 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pages-cf.yml create mode 100644 .github/workflows/pages-eo.yml rename .github/workflows/{deploy.yml => workers.yml} (85%) diff --git a/.github/workflows/pages-cf.yml b/.github/workflows/pages-cf.yml new file mode 100644 index 0000000..e634f85 --- /dev/null +++ b/.github/workflows/pages-cf.yml @@ -0,0 +1,32 @@ +name: Deploy to Cloudflare Pages + +on: + push: + branches: + - pages + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + deployments: write + + steps: + - name: Checkout pages branch + uses: actions/checkout@v5 + with: + ref: pages + + - name: Deploy to Cloudflare Pages + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy . --project-name=xget --branch=${{ github.ref_name }} diff --git a/.github/workflows/pages-eo.yml b/.github/workflows/pages-eo.yml new file mode 100644 index 0000000..0dc4f1b --- /dev/null +++ b/.github/workflows/pages-eo.yml @@ -0,0 +1,40 @@ +name: Deploy to EdgeOne Pages + +on: + push: + branches: + - pages + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: false + +jobs: + deploy: + runs-on: ubuntu-latest + timeout-minutes: 15 + permissions: + contents: read + + steps: + - name: Checkout pages branch + uses: actions/checkout@v5 + with: + ref: pages + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '22.11.0' + + - name: Install dependencies + run: npm install + + - name: Build project + run: npm run build + + - name: Deploy to EdgeOne Pages + run: npx edgeone pages deploy . -n xget-pages -t ${{ secrets.EDGEONE_API_TOKEN }} + env: + EDGEONE_API_TOKEN: ${{ secrets.EDGEONE_API_TOKEN }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/workers.yml similarity index 85% rename from .github/workflows/deploy.yml rename to .github/workflows/workers.yml index 7313876..90ae293 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/workers.yml @@ -24,13 +24,15 @@ concurrency: jobs: deploy: runs-on: ubuntu-latest - timeout-minutes: 60 + timeout-minutes: 15 permissions: contents: read + deployments: write steps: - - name: Checkout repository + - name: Checkout main branch uses: actions/checkout@v5 - - name: Deploy Worker + + - name: Deploy to Cloudflare Workers uses: cloudflare/wrangler-action@v3 with: apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}