Closed tien closed 5 days ago
+1, encountering the same issue. Using --env production
deploys two workers (worker
and worker-production
and sets secrets on worker
instead of worker-production
.
From looking at the source code, I found out that there's actually an environment
parameter that you can pass to the action. This needs to be documented.
Thanks @tien can you provide an example?
I see what you are referring to, thank you.
https://github.com/cloudflare/wrangler-action/blob/main/src/index.ts#L28
From looking at the source code, I found out that there's actually an
environment
parameter that you can pass to the action. This needs to be documented.
This saved me a lot of pain, thank you
FYI if someone if looking for the exact match:
- uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
command: deploy --env production
secrets: |
SUPER_SECRET
environment: production
env:
SUPER_SECRET: ${{ secrets.SUPER_SECRET }}
Thanks for bringing this up! The docs have been updated.
Assuming the worker name is
my-worker
doing the above would create 2 workers:my-worker
&my-worker-production
with the secrets only set formy-worker
.