saitho / semantic-release-backmerge

:twisted_rightwards_arrows: semantic-release plugin to back-merge a release into a develop branch
https://saitho.github.io/semantic-release-backmerge/
56 stars 11 forks source link

Usage and documentation #48

Closed tomavic closed 9 months ago

tomavic commented 1 year ago

Is there an existing issue for this?

Current Behavior

This is not a bug or issue, but I need help in order to use this plugin.

Expected Behavior

I need to use this plugin with my workflow:

master/main -> has the most stable features on production. develop -> has the most recent features that are not published yet release/** -> they are considered a dummy branches although they are dummy :)

How I start developing features and release them.

Starting from develop, a feat branch is taken from develop branch. I finish developing and open Pull Request and wait for it to be merged.

When the testing team is ready to test my feature, I push my develop to a new release branch e.g. release/1.2.0.

This branch will be marked as prerelease, means that my package.json version will be 1.2.0-1

When I repeat the same previous steps again to add more feat/fix, the prerelease number only increases. 1.2.0-2 & 1.2.0-3 and so on.

HERE IS THE PROBLEM:

Whenever a successful release completes on release/** branches, the pipelines creates a tag and commit with that release/** branch. At this moment I do manual Pull request from release/** to develop branch, in order to update the develop branch. WHY?

Because if I didn't do that, in the next time when I push develop with new feat/fix to the same release, the version in the package.json will not be updated.

MY Question here:

What is your recommendation in order to automate this with semantic release as much as possible??

Steps To Reproduce

..

Environment

- **semantic-release/semantic-release** version:
- **@saithodev/semantic-release-backmerge** version:

Anything else?

No response

saitho commented 1 year ago

Hi @tomavic

sorry for the late reply.

TBH I have moved away from using develop branches for my own projects. Also at work we have done so. So I don't really have any experience with the multi-branch versioning feature of semantic-release.

Your prereleases happen in release/** branches with prerelease tags. I'd expect the release/** branch to be merged into master when it's ready for production. Then the backmerge workflow for master -> develop should work as expected.

If you need to backmerge the release/** branch into develop beforehand as well, you should be able to it up like this.

{
  "plugins": [
    [
      "@saithodev/semantic-release-backmerge",
      {
        "backmergeBranches": [{"from": "master", "to": "develop"}, {"from": "release/*", "to": "develop"}],
        "mergeMode": "theirs", // prefer changes of "from" branch
        "fastForwardMode": "ff" // upcoming feature of v3.2.0
      }
    ]
  ]
}

Then, if you create prereleases via semantic-release on release/* branches, the should be backmerged into `develop as well.

tomavic commented 1 year ago

Thanks @saitho

I have already dropped the development with dev branch workflow in my personal projects, I would really love to do this for my corporate but I am not be able to apply this change for all projects at once 😢

I will try your trick and update here. 🙏