norbux
norbux5mo ago

Hello,

I would like to use github actions to deploy to dev, I normally do it from the cli like npx convex dev. I have created a deployment key in the Convex dashboard for both dev and production and added those as secrets in github. In my github workflow I am adding the key into an env variable like this:
env:
CONVEX_DEPLOY_KEY: "${{ secrets.CONVEX_DEPLOY_KEY_DEV }}"
env:
CONVEX_DEPLOY_KEY: "${{ secrets.CONVEX_DEPLOY_KEY_DEV }}"
Then, in the job steps I am doing this:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install convex dotenv
- run: export CONVEX_DEPLOY_KEY="$CONVEX_DEPLOY_KEY"
- run: npx convex dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- run: npm install convex dotenv
- run: export CONVEX_DEPLOY_KEY="$CONVEX_DEPLOY_KEY"
- run: npx convex dev
I can see in the action output that the convex key shows obfuscated. When it gets to the point of running npx convex dev it fails because Convex expects a user interaction of visiting a URL to authorize instead of using the environment CONVEX_DEPLOY_KEY. I'm surely doing something wrong. Does anyone has a hint?
7 Replies
jamwt
jamwt5mo ago
Try npx convex deploy
norbux
norbuxOP5mo ago
but wouldn't that deploy to production?
jamwt
jamwt5mo ago
CLI | Convex Developer Hub
The Convex command-line interface (CLI) is your interface for managing Convex
jamwt
jamwt5mo ago
Any particular reason you want to deploy to dev in this way? Instead of a preview deployment?
norbux
norbuxOP5mo ago
It works, thanks a lot Jamie I was just trying without having read yet about preview deployments, will do that instead, thank you 👍
jamwt
jamwt5mo ago
no problem!
norbux
norbuxOP5mo ago
I have this scenario, I don't use a frontend, I am only using Convex as a backend for some slack bot. What I would like to have is a workflow in which if I push a PR to a feature branch it would deploy to a preview deployment or dev deployment or something that let me see the logs of my Convex backend and then if I merge to main I would have it deploy to production are preview deployments suitable for tha scenario? oh sorry, I see it works as I expected, I just made a mistake and didn't push my cron.ts and that's why I wasn't seeing logs. All good, thanks

Did you find this page helpful?