Deploy Docs #15
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 Docs | |
| on: | |
| # push: | |
| # paths: | |
| # - 'website/**' | |
| # branches: | |
| # - main | |
| workflow_dispatch: | |
| # repository_dispatch: | |
| # types: [deploy_docs] | |
| jobs: | |
| build: | |
| name: Deploy production docs | |
| if: github.ref != 'refs/heads/next' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22] | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build:docs | |
| - name: Require Cloudflare token | |
| if: env.CLOUDFLARE_API_TOKEN == '' | |
| run: | | |
| { | |
| echo "## Deploy blocked" | |
| echo "- \`CLOUDFLARE_API_TOKEN\` is not configured for this repository." | |
| echo "- Docs build completed successfully, but production deployment cannot continue." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| echo "::error::CLOUDFLARE_API_TOKEN is required to deploy production docs." | |
| exit 1 | |
| - name: Deploy | |
| if: env.CLOUDFLARE_API_TOKEN != '' | |
| run: pnpm exec wrangler deploy --config wrangler.jsonc | |
| working-directory: ./website | |
| - name: Verify deployed assets | |
| if: env.CLOUDFLARE_API_TOKEN != '' | |
| run: pnpm run verify:deployment -- https://tw.icebreaker.top | |
| working-directory: ./website | |
| # uses: cloudflare/wrangler-action@v3 | |
| # with: | |
| # apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| # accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| # workingDirectory: ./website | |
| # command: pages deploy .vitepress/dist --project-name=host-docs | |
| next: | |
| name: Deploy next docs | |
| if: github.ref == 'refs/heads/next' | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22] | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build workspace dependencies | |
| run: pnpm --filter @weapp-tailwindcss/website... --filter '!@weapp-tailwindcss/website' build | |
| - name: Build next docs | |
| run: pnpm --filter @weapp-tailwindcss/website build:next | |
| - name: Require next Cloudflare token | |
| if: env.CLOUDFLARE_API_TOKEN == '' | |
| run: | | |
| { | |
| echo "## Deploy blocked" | |
| echo "- \`CLOUDFLARE_API_TOKEN\` is not configured for this repository." | |
| echo "- Next docs build completed successfully, but deployment cannot continue." | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| echo "::error::CLOUDFLARE_API_TOKEN is required to deploy next docs." | |
| exit 1 | |
| - name: Deploy next docs | |
| if: env.CLOUDFLARE_API_TOKEN != '' | |
| run: pnpm --filter @weapp-tailwindcss/website deploy:next | |
| - name: Verify next deployed assets | |
| if: env.CLOUDFLARE_API_TOKEN != '' | |
| run: pnpm --filter @weapp-tailwindcss/website verify:deployment -- https://next.tw.icebreaker.top |