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 site to Cloudflare Pages | |
| on: | |
| push: | |
| branches: | |
| - 'main' # 当推送到 main 分支时触发 | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/deploy.yml' | |
| - 'package.json' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 检出代码 | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: 安装依赖 | |
| run: npm install | |
| - name: 构建项目 | |
| run: npm run docs:build # 构建 VitePress 项目 | |
| - name: Install Wrangler | |
| run: npm install -g wrangler@4.16.1 | |
| - name: Deploy to Cloudflare Pages | |
| id: deploy | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_PAGES_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_PAGES_ACCOUNT }} | |
| command: pages deploy docs/.vitepress/dist --project-name=aboutrans | |