Issues with environment variables when deploying a pages project in GitHub/Gitea action
Heya,
I'm using a self-hosted Gitea instance as VCS, which has a GitHub Actions compatible worker environment. What I'm trying to deploy to Cloudflare Pages is a Nuxt 3 project.
I have some problems figuring out how to deploy the environment variables and secrets.
When running
pnpm run build && wrangler pages deploy
locally in my dev environment it deploys all fine, but not when I do that in my deploy action.
The main difference between my local environment and the action runner environment is probably that I don't have a .dev.vars
file there and also the .env
file would not contain all necessary variables in the action runner.
Unfortunately the cloudflare/wrangler-action@v3
does not yet support setting secrets as options for pages projects. This only works for worker projects: https://github.com/cloudflare/wrangler-action/issues/304
I'm wondering what's missing here for my environment variables to be deployed successfully.
build.yaml:
Thank you in advance for guiding me into any useful direction ๐GitHub
uploading environment secrets doesn't work with pages deploy ยท Issu...
wrangler-action/src/index.ts Line 251 in cd8a317 const args = ["wrangler", "secret:bulk"]; When the repository is pages directory, it needs to run wrangler pages secret bulk Oth...
1 Reply
Okay, I figured out what the problem was. All the environment variables need to be part of the build step, not part of the
wrangler pages deploy
step ๐คฆ The reason why it was always working when I deployed from my own machine was obviously that I always had the .env file there.