migrate: sync with vitepress #14
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: Deploy VitePress | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 11 | |
| - 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('document/**', 'site/.vitepress/**', 'scripts/build.ts', 'site/package.json', 'site/pnpm-lock.yaml') }} | |
| - 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 | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site/.vitepress/dist |