wrangler-action icon indicating copy to clipboard operation
wrangler-action copied to clipboard

`pages deploy` does not deploy to production

Open dapperdandev opened this issue 1 year ago • 2 comments

I'm trying to deploy to production (not preview). There doesn't seem to be an option to do so.

            - name: Deploy
              uses: cloudflare/wrangler-action@v3
              with:
                  apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
                  accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
                  command: pages deploy dist --project-name=app-${{env.ENV_NAME}}

image

dapperdandev avatar Dec 10 '24 23:12 dapperdandev

Found my own solution. HEAD in the screenshot in the original report is the GitHub branch. In this case, it's HEAD because the action was triggered on release creation.

I found the option to change the "production branch" and updated that to rc, since we'll be triggering this action on pull_request to rc.

image
image

I still have a question:

I can pass the --branch=my-branch-name in the command. This doesn't actually change where the code I upload comes from though. It seems to just be a roundabout way of telling CloudFlare Pages to deploy to production or preview. Is that right? Or does CloudFlare have a concept of branches on their end? If so, how do we manage branches in CloudFlare Pages?

dapperdandev avatar Dec 12 '24 16:12 dapperdandev

I still have a question:

I can pass the --branch=my-branch-name in the command. This doesn't actually change where the code I upload comes from though. It seems to just be a roundabout way of telling CloudFlare Pages to deploy to production or preview. Is that right? Or does CloudFlare have a concept of branches on their end? If so, how do we manage branches in CloudFlare Pages?

Yepp, that's right, it's a horribly named option as it's just a named reference to the deployment configured in Cloudflare (as "Source").

But there's no correlation to the branch, as wrangler will upload whatever asset(s) are on the commit that was checked out.

Furthermore, it amazes me to no end that Cloudflare lacks support for tags and multiple environments (dev, stage, production etc.) and that they claim that "most" use a Git Flow branch strategy. Which I'm pretty sure is a lie.

Anyway, enough ranting. Using the "--branch" option, once we understood it has nothing to do with branches, helped us solve so that we can publish previews for PRs, dev (main branch), and stage (release branches).

The only thing missing now is having static domains for dev and stage. The jury is out on if that's supported or not.

BeyondEvil avatar Feb 02 '25 14:02 BeyondEvil