Deploy to branch with cli

I would like to deploy only after my CI tests pass, and I could do it using yarn deploy --site #my_site_id --auth #my_token --prod for the production branch.
I can’t find a way to do this for the develop and staging branch though.

Right now all I can find is 2 choices:
1- Set automatic deploys, set branch subdomains and have my code deployed on the correct branch but ignoring my tests
2- Disable automatic deploys and deploy my code to production after my tests pass, but no develop or staging subdomains.

Can you please tell me if there is a way to deploy programmatically to a specified subdomain (branch)?
(or a way for Netlify to wait for GitLab CI tests to pass before auto deploying? )

My netlify instance name is:

Hi there,

If I’m understanding your situation correctly, i don’t think this is possible at the moment.

There is a partial workaround that might work for you written out here:

Thank you for your quick answer!

So basically, to deploy a site on a branch using autodeploy, I would have to either run test locally using a git pre-hook or use netlify CI, am I right?

You have two options on Netlify CI/CD – automatic deploys (default behavior) triggered by commits to your repository or trigger a deploy using a build hook in your own CI. Let me know if that answers your question.