From 98e81c5a79c43adee7b5f369d496d01199cc4d17 Mon Sep 17 00:00:00 2001 From: Gaubee Date: Wed, 7 Jan 2026 11:43:30 +0800 Subject: [PATCH] fix(cd): switch to gh-pages branch deployment with force-push - Remove actions/upload-pages-artifact and actions/deploy-pages - Use direct git push -f to gh-pages branch for both self-hosted and github-hosted runners - Ensures no history bloat and avoids artifact upload issues --- .github/workflows/cd.yml | 34 +++++++++++++--------------------- 1 file changed, 13 insertions(+), 21 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index e10db3ff9..2e75b2116 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -449,11 +449,19 @@ jobs: bun scripts/build.ts dweb --upload --skip-typecheck --skip-test fi - # ===== 上传构建产物 ===== - - name: Upload GitHub Pages artifact - uses: actions/upload-pages-artifact@v3 - with: - path: gh-pages + # ===== 部署到 GitHub Pages (Force Push) ===== + - name: Deploy to GitHub Pages + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + cd gh-pages + git init + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "Deploy to GitHub Pages - ${{ github.sha }}" + git push -f "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git" HEAD:gh-pages + echo "Deployed to gh-pages branch" - name: Upload release artifacts uses: actions/upload-artifact@v4 @@ -462,22 +470,6 @@ jobs: path: release/ retention-days: 30 - # ==================== 部署到 GitHub Pages (GitHub-hosted only) ==================== - # Self-hosted 版本直接在 build-fast 中用 git push 部署,避免 upload-pages-artifact 卡住 - deploy-pages-standard: - if: vars.USE_SELF_HOSTED != 'true' - needs: build-standard - runs-on: ubuntu-latest - - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 - # ==================== 创建 Release (GitHub-hosted) ==================== create-release-standard: if: vars.USE_SELF_HOSTED != 'true'