diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 67cb74b..8825602 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -69,10 +69,14 @@ jobs: runs-on: ubuntu-latest permissions: contents: read - deployments: write + env: + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} steps: - - name: Check out repository - uses: actions/checkout@v5 + - name: Set up Node.js + uses: actions/setup-node@v5 + with: + node-version: '22' - name: Download static site uses: actions/download-artifact@v7 @@ -80,11 +84,22 @@ jobs: name: lingxigraph-docs path: Wiki/out + - name: Validate Cloudflare credentials + shell: bash + run: | + if [ -z "$CLOUDFLARE_API_TOKEN" ]; then + echo "::error::Repository secret CLOUDFLARE_API_TOKEN is missing or empty." + exit 1 + fi + if [ -z "$CLOUDFLARE_ACCOUNT_ID" ]; then + echo "::error::Repository secret CLOUDFLARE_ACCOUNT_ID is missing or empty." + exit 1 + fi + - name: Deploy to Cloudflare Pages - uses: cloudflare/wrangler-action@v4 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - wranglerVersion: '4' - command: pages deploy Wiki/out --project-name=lingxigraph-docs - gitHubToken: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: >- + npx --yes wrangler@4.122.0 pages deploy Wiki/out + --project-name=lingxigraph-docs + --branch=main + --commit-hash="$GITHUB_SHA"