`pages deploy` does not deploy to production
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}}
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.
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?
I still have a question:
I can pass the
--branch=my-branch-namein 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 toproductionorpreview. 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.