Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 23 additions & 3 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ jobs:
cp release/bfmpay-dweb-beta.zip "release/bfmpay-dweb-${VERSION}-beta.zip"
fi

# 直接推送到 gh-pages 分支,避免使用 upload-pages-artifact(self-hosted 上容易卡住)
- name: Deploy to GitHub Pages
# 推送到 gh-pages 分支,然后通过 API 触发 GitHub Actions 部署
- name: Push to gh-pages branch
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Expand All @@ -180,7 +180,27 @@ jobs:
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"
echo "Pushed to gh-pages branch"

- name: Trigger GitHub Pages deployment
env:
GH_TOKEN: ${{ github.token }}
run: |
# 获取 gh-pages 分支最新的 commit SHA
PAGES_SHA=$(git ls-remote origin gh-pages | cut -f1)
echo "gh-pages SHA: $PAGES_SHA"

# 通过 GitHub API 创建 Pages 部署
gh api \
--method POST \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/pages/deployments \
-f artifact_url="https://api.github.com/repos/${{ github.repository }}/tarball/gh-pages" \
-f pages_build_version="$PAGES_SHA" \
-f oidc_token="${{ secrets.GITHUB_TOKEN }}" \
&& echo "Pages deployment triggered successfully" \
|| echo "Pages deployment API call failed (may need manual configuration)"

# 直接在 build job 中创建 release,避免跨 job 传递 artifact(self-hosted 下载很慢)
- name: Create or Update Release
Expand Down