diff --git a/.github/workflows/website-docs.yml b/.github/workflows/website-docs.yml index 0f4aed0797..7bd0641768 100644 --- a/.github/workflows/website-docs.yml +++ b/.github/workflows/website-docs.yml @@ -72,13 +72,23 @@ jobs: path: docs/website/public if-no-files-found: error + - name: Check Cloudflare deploy credentials + if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && (secrets.CLOUDFLARE_API_TOKEN == '' && secrets.CF_API_TOKEN == '') }} + run: | + echo "::warning::Skipping Cloudflare Pages deploy because no API token secret is configured. Set CLOUDFLARE_API_TOKEN (preferred) or CF_API_TOKEN." + - name: Deploy to Cloudflare Pages - if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') }} + if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master') && (secrets.CLOUDFLARE_API_TOKEN != '' || secrets.CF_API_TOKEN != '') }} uses: cloudflare/wrangler-action@v3 + env: + # Keep these env vars explicit so Wrangler can authenticate in non-interactive CI. + CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN || secrets.CF_API_TOKEN }} + CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || secrets.CF_ACCOUNT_ID }} with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + # Also pass through action inputs for compatibility with wrangler-action versions. + apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN || secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID || secrets.CF_ACCOUNT_ID }} command: >- pages deploy docs/website/public - --project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CLOUDFLARE_PAGES_PROJECT_NAME || 'codenameone' }} + --project-name=${{ vars.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CLOUDFLARE_PAGES_PROJECT_NAME || secrets.CF_PAGES_PROJECT_NAME || 'codenameone' }} --branch=${{ github.ref_name }}