Best practices for deploying a monorepo to dev/staging/prod environments?


#1

Hi all!

I apologize if this is too general a question, but I’m new to CI, and having difficulty wrapping my head around how things should be structured.

Ideally, I would like to run the unit tests for each commit on any branch, and report success/failure.

For commits to master, I’d like to automatically deploy to a staging environment and run some integration tests, then (with a manual approval step) deploy to a production environment.

I’m also using a monorepo.

Currently, I have a generic build job that uses git to determine which of my child directories in the monorepo have seen changes. I’ve also defined child jobs (service1, service2, etc) that get called by the generic build if the directory of the service has changed files. I have a workflow that calls the generic build job, and then that job triggers whatever children are necessary.

Would I need to setup another workflow that’s scoped only to master to support a deploy to staging/prod? Does that workflow need to kick off another prod workflow if I want to have to manually approve a prod deployment job? How should I be doing this?

I’m not sure if this complicates things, but all of my services are AWS golang lambdas–so far, deployment has simply been a matter of building my bins locally and then pushing them to AWS using serverless.