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 }}