feat: add documentation for Undefined Behavior and Data-Oriented Desi… #244
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
| # 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 | |
| # | |
| name: Check and deploy VitePress site | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| # 默认只授予读取代码的权限;部署 job 单独申请 Pages 权限。 | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: pages-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| quality: | |
| name: Quality checks | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Verify deploy-time share ID generation | |
| run: pnpm share-links:prepare | |
| - name: Check committed secrets | |
| run: pnpm check:secrets | |
| - name: Type-check VitePress config | |
| run: pnpm typecheck | |
| - name: Type-check Vue theme | |
| run: pnpm typecheck:vue | |
| - name: Run unit tests | |
| run: pnpm test | |
| build: | |
| name: Build YuuFrag and short-link artifacts | |
| if: github.event_name != 'pull_request' | |
| needs: quality | |
| runs-on: ubuntu-latest | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.CONTRIBUTOR_TOKEN || github.token }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build with VitePress | |
| run: pnpm docs:build | |
| - name: Verify both share-link artifacts | |
| run: pnpm share-links:artifacts:check | |
| - name: Upload standalone short-link archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: yuufrag-shortlinks | |
| path: .shortlink-dist | |
| if-no-files-found: error | |
| retention-days: 30 | |
| include-hidden-files: true | |
| - name: Upload YuuFrag Pages artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: .vitepress/dist | |
| deploy: | |
| if: github.event_name != 'pull_request' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| name: Deploy | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v5 |