wakatime / semver-action

Auto-generate the next semantic version.
MIT License
11 stars 0 forks source link

Add new conditional for resync prefix #13

Closed gandarez closed 3 years ago

gandarez commented 3 years ago

This PR adds a new conditional for resync prefix. It will allow to resync/update develop branch when a hotfix is done at master. A new branch must be suffixed with resync/*.

Closes https://github.com/wakatime/semver-action/issues/8

gandarez commented 3 years ago

@dron22 I changed resync method a little bit to accomodate its behaviour in a simpler way.

greater and less here are used when semver tags are compared between each other.

The following scenarios list tags in the creation orders. Tags generated from hotfix branches will be always the first ones in the list.

1st scenario - If latest tag from semver is greater than ancestor develop (prerelease) - Should generate a new develop tag v1.2.1-alpha.1

2nd scenario - If latest tag from semver is less than ancestor develop (prerelease) - Should bump build version resulting in v1.3.0-alpha.2

dron22 commented 3 years ago

Question on scenario #1:

Which tag will be created in master for the new release?

gandarez commented 3 years ago

Question on scenario #1:

  • Let's say, resync bumps develop version to v1.2.1-alpha.1, like you described.
  • Then we merge some doc change into develop and we'll be at v1.2.1-alpha.2.
  • Then we merge develop into master.

Which tag will be created in master for the new release?

tag will be 💣 lol ... I had the same thought when developing it but I forgot about doc and misc prefixes. So the only way for it is to always bump patch version. I'll fix it.

gandarez commented 3 years ago

@dron22 I replaced the new resync method by using the same logic as patch increment, like bugfix. By doing in this way we won't have any problems regarding the 1st scenario you mentioned. Thanks 🙏