chore(sidebar): leave a note for the retired json era #629
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build VitePress and Push to Private Repo | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Wait for case sensitivity check | |
| run: | | |
| echo "Waiting for case sensitivity check to complete..." | |
| # Get the latest workflow run for case sensitivity check | |
| WORKFLOW_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/actions/workflows" | \ | |
| jq -r '.workflows[] | select(.name == "Case Sensitivity Check") | .id') | |
| if [ "$WORKFLOW_ID" = "null" ] || [ -z "$WORKFLOW_ID" ]; then | |
| echo "Case sensitivity workflow not found, proceeding with build" | |
| exit 0 | |
| fi | |
| echo "Found case sensitivity workflow ID: $WORKFLOW_ID" | |
| # Wait for the workflow to complete (max 10 minutes) | |
| for i in {1..60}; do | |
| LATEST_RUN=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| "https://api.github.com/repos/${{ github.repository }}/actions/workflows/$WORKFLOW_ID/runs?per_page=1&branch=main") | |
| STATUS=$(echo "$LATEST_RUN" | jq -r '.workflow_runs[0].status') | |
| CONCLUSION=$(echo "$LATEST_RUN" | jq -r '.workflow_runs[0].conclusion') | |
| echo "Case sensitivity check status: $STATUS, conclusion: $CONCLUSION" | |
| if [ "$STATUS" = "completed" ]; then | |
| if [ "$CONCLUSION" = "success" ]; then | |
| echo "Case sensitivity check completed successfully" | |
| exit 0 | |
| else | |
| echo "Case sensitivity check failed with conclusion: $CONCLUSION" | |
| exit 1 | |
| fi | |
| fi | |
| echo "Still waiting... (attempt $i/60)" | |
| sleep 10 | |
| done | |
| echo "Timeout waiting for case sensitivity check" | |
| exit 1 | |
| - name: Checkout the code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # Ensure we get the latest changes after case sensitivity fixes | |
| ref: ${{ github.ref }} | |
| - name: Verify repository state | |
| run: | | |
| echo "Verifying repository state after case sensitivity fixes..." | |
| # Check for any remaining case conflicts | |
| CONFLICTS=$(git ls-files | sort -f | uniq -i -d || true) | |
| if [ -n "$CONFLICTS" ]; then | |
| echo "Warning: Case conflicts still detected:" | |
| echo "$CONFLICTS" | |
| echo "Proceeding with build anyway..." | |
| else | |
| echo "No case conflicts detected, repository is clean" | |
| fi | |
| echo "Repository status:" | |
| echo "- Branch: $(git branch --show-current)" | |
| echo "- Latest commit: $(git log -1 --oneline)" | |
| echo "- Total files: $(git ls-files | wc -l)" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.19.0" | |
| cache: "yarn" | |
| - name: Configure Yarn | |
| run: yarn config set registry https://registry.npmmirror.com | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build VitePress site | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=8192 | |
| run: | | |
| echo "Building VitePress site..." | |
| yarn docs:build | |
| echo "VitePress site build completed" | |
| - name: Copy deployment workflow | |
| run: | | |
| # 创建目标目录 | |
| mkdir -p .vitepress/dist/.github/workflows/ | |
| # 克隆包含部署workflow的仓库 | |
| git clone --depth 1 https://${{ secrets.PICKAID_TOKEN }}@github.com/M1hono/CrychicDocWorkflow.git workflow_repo | |
| # 复制部署workflow | |
| cp workflow_repo/.github/workflows/deploy.yml .vitepress/dist/.github/workflows/ | |
| # 清理临时目录 | |
| rm -rf workflow_repo | |
| echo "Deployment workflow copied successfully" | |
| - name: Push to private repo | |
| run: | | |
| cd .vitepress/dist | |
| 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 "Update documentation (after case sensitivity fixes)" | |
| git push --force https://${{ secrets.PICKAID_TOKEN }}@github.com/M1hono/CrychicDocSynchronization.git HEAD:main | |
| echo "Push completed successfully" | |
| - name: Cleanup | |
| run: | | |
| rm -rf .vitepress/dist | |
| rm -rf workflow_repo | |
| echo "🧹 Cleanup completed" | |
| - name: Build summary | |
| run: | | |
| echo "Build Summary:" | |
| echo "Case sensitivity check: Passed" | |
| echo "Dependencies installation: Completed" | |
| echo "VitePress build: Completed" | |
| echo "Deployment: Completed" | |
| echo "All steps completed successfully!" |