|
@@ -3,72 +3,74 @@ on:
|
|
|
workflow_dispatch
|
|
workflow_dispatch
|
|
|
|
|
|
|
|
concurrency:
|
|
concurrency:
|
|
|
- group: "main-deploy-branch-workflow" # 唯一标识符,确保只运行一个实例
|
|
|
|
|
- cancel-in-progress: false # 不取消正在运行的实例,后续触发需要等待当前实例完成
|
|
|
|
|
|
|
+ group: "main-deploy-branch-workflow"
|
|
|
|
|
+ cancel-in-progress: false
|
|
|
|
|
|
|
|
jobs:
|
|
jobs:
|
|
|
build:
|
|
build:
|
|
|
runs-on: ubuntu-latest
|
|
runs-on: ubuntu-latest
|
|
|
permissions:
|
|
permissions:
|
|
|
- contents: read
|
|
|
|
|
|
|
+ contents: write
|
|
|
pages: write
|
|
pages: write
|
|
|
id-token: write
|
|
id-token: write
|
|
|
steps:
|
|
steps:
|
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/checkout@v3
|
|
|
with:
|
|
with:
|
|
|
fetch-depth: 2
|
|
fetch-depth: 2
|
|
|
- - name: Check if branch is main
|
|
|
|
|
- run: |
|
|
|
|
|
- if [ "$GITHUB_REF" != "refs/heads/main" ]; then
|
|
|
|
|
- echo "Not on main branch, exiting workflow."
|
|
|
|
|
- exit 1
|
|
|
|
|
- fi
|
|
|
|
|
- echo "On main branch, continuing workflow."
|
|
|
|
|
|
|
+ persist-credentials: true
|
|
|
|
|
+
|
|
|
- name: Config Git User
|
|
- name: Config Git User
|
|
|
run: |
|
|
run: |
|
|
|
git config --local user.name "dragooncjw"
|
|
git config --local user.name "dragooncjw"
|
|
|
git config --local user.email "289056872@qq.com"
|
|
git config --local user.email "289056872@qq.com"
|
|
|
|
|
+
|
|
|
- uses: actions/setup-node@v3
|
|
- uses: actions/setup-node@v3
|
|
|
with:
|
|
with:
|
|
|
node-version: 18
|
|
node-version: 18
|
|
|
registry-url: 'https://registry.npmjs.org/'
|
|
registry-url: 'https://registry.npmjs.org/'
|
|
|
|
|
+
|
|
|
- name: Rush Install
|
|
- name: Rush Install
|
|
|
- run: node common/scripts/install-run-rush.js install
|
|
|
|
|
|
|
+ run: node common/scripts/install-run-rush.js install -t @flowgram.ai/docs
|
|
|
|
|
+
|
|
|
- name: Rush build
|
|
- name: Rush build
|
|
|
- run: node common/scripts/install-run-rush.js build
|
|
|
|
|
|
|
+ run: node common/scripts/install-run-rush.js build -t @flowgram.ai/docs
|
|
|
|
|
+
|
|
|
- name: Generate docs
|
|
- name: Generate docs
|
|
|
run: |
|
|
run: |
|
|
|
cd apps/docs
|
|
cd apps/docs
|
|
|
npm run docs
|
|
npm run docs
|
|
|
|
|
+
|
|
|
- name: Copy auto-docs to en
|
|
- name: Copy auto-docs to en
|
|
|
run: cp -r apps/docs/src/zh/auto-docs apps/docs/src/en/auto-docs
|
|
run: cp -r apps/docs/src/zh/auto-docs apps/docs/src/en/auto-docs
|
|
|
|
|
+
|
|
|
- name: Build Doc site
|
|
- name: Build Doc site
|
|
|
run: |
|
|
run: |
|
|
|
cd apps/docs
|
|
cd apps/docs
|
|
|
npm run build
|
|
npm run build
|
|
|
|
|
+
|
|
|
- name: Replace docs
|
|
- name: Replace docs
|
|
|
run: |
|
|
run: |
|
|
|
rm -rf docs
|
|
rm -rf docs
|
|
|
mv apps/docs/doc_build docs
|
|
mv apps/docs/doc_build docs
|
|
|
- - name: Upload artifact
|
|
|
|
|
- uses: actions/upload-pages-artifact@v3
|
|
|
|
|
- with:
|
|
|
|
|
- path: docs
|
|
|
|
|
- name: github-pages
|
|
|
|
|
|
|
|
|
|
- deploy:
|
|
|
|
|
- permissions:
|
|
|
|
|
- contents: read
|
|
|
|
|
- pages: write
|
|
|
|
|
- id-token: write
|
|
|
|
|
- needs: build
|
|
|
|
|
- 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
|
|
|
|
|
|
|
+ # 🔥 新增步骤:在 docs 目录下生成 vercel.json
|
|
|
|
|
+ - name: Create vercel.json
|
|
|
|
|
+ run: |
|
|
|
|
|
+ cat > docs/vercel.json <<EOF
|
|
|
|
|
+ {
|
|
|
|
|
+ "version": 2,
|
|
|
|
|
+ "buildCommand": "",
|
|
|
|
|
+ "outputDirectory": ".",
|
|
|
|
|
+ "cleanUrls": true,
|
|
|
|
|
+ "trailingSlash": false
|
|
|
|
|
+ }
|
|
|
|
|
+ EOF
|
|
|
|
|
|
|
|
|
|
+ # 🔥 推送到 gh-pages 分支
|
|
|
|
|
+ - name: Push to gh-pages branch
|
|
|
|
|
+ uses: peaceiris/actions-gh-pages@v3
|
|
|
|
|
+ with:
|
|
|
|
|
+ github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
+ publish_dir: ./docs
|
|
|
|
|
+ publish_branch: gh-pages
|
|
|
|
|
+ force: true
|