update mainly of the repo #5
Workflow file for this run
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 Check | |
| # PR 和 push 到 main 时验证站点能构建通过。 | |
| # pnpm build 内置 post-build 死链检查(scripts/build.ts 的 checkSiteIssues), | |
| # 所以这一步同时守住「构建」和「死链纪律」两道关——坏构建或死链都会在 PR 阶段被拦下。 | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # build-info.ts 的 git describe 需要完整历史拿版本号 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Get pnpm store directory | |
| shell: bash | |
| run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ env.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('site/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Setup build cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: site/.vitepress/.build-cache | |
| key: vitepress-build-${{ runner.os }}-${{ hashFiles('site/pnpm-lock.yaml', 'scripts/build.ts', 'site/.vitepress/config/*') }} | |
| restore-keys: | | |
| vitepress-build-${{ runner.os }}- | |
| vitepress-build- | |
| - name: Install dependencies | |
| working-directory: site | |
| run: pnpm install --frozen-lockfile | |
| - name: Build website (含死链检查) | |
| working-directory: site | |
| run: pnpm build | |
| env: | |
| NODE_OPTIONS: --max-old-space-size=6144 | |
| BUILD_CONCURRENCY: 8 |