ElasticBeanstalk/Create version in tag pipeline and deploy on branch


I think this is a basic question but I can’t quite wrap my head around it. I have a repo that uses semantic version and deploys to elastic beanstalk.

My workflow is roughly like this:

  • Developer makes feature on feature-branch
  • When done, merge into develop-branch. Develop-branch creates version on elastic beanstalk and deploys it to test environment
  • When ready, merge develop into master branch. Master branch deploys the version to production.

The problem is, I can’t push anything directly to the master-branch because that pipeline wouldn’t create a new application version on EB.

So I was thinking, when my version job creates the tag and release, couldn’t I have the tag pipeline create the application version on EB? So it would work something like this:

  • semantic version job (on any branch) runs which may or may not create a release
  • if release is created, tag pipeline starts (detached), which creates application version on EB
  • later in the branch pipeline, the latest tag is deployed to the desired channels

The problem of course here is that the tag pipeline is detached, so I couldn’t wait for the job in the branch pipeline. But I feel like creating application version in the tag pipeline is a great solution because it would work for any branch even if I have more distribution channels later.

I can think of some solutions, but I’m not sure which would end up working out in the end. For example, I could create tags before they’re merged to a branch. I’m not sure if this would mean I have to configure sematic release to make prereleases. Also, wouldn’t I have to keep the feature branches if I make a protected tag on a commit in the branch?

Did anyone ever implement a workflow like this? I appreciate any suggestions or resources on how to make this work!

Thanks :slight_smile: