auto icon indicating copy to clipboard operation
auto copied to clipboard

Auto's versioning gets confused when merging release branch into next

Open rconnamacher opened this issue 3 years ago • 0 comments

Describe the bug

When merging a main / release branch into a next / beta branch with prereleases enabled and auto shipit as a build step, Auto will create a new prerelease version from that commit with -beta.0 or -next.0, etc as the semver pre-release suffix.

If that same commit being built already has a production version tag on it, it'll get double-tagged as if it's also the next prerelease version.

The next real prerelease version will then fail to see it, and will attempt to reuse the suffix -beta.0 or -next.0, causing the build to break.

To Reproduce

  1. Configure your repo with a release branch, such as main, and a prerelease branch, such as beta. Run auto shipit as a standard build step on both branches.
  2. Release a commit to main that generates an Auto release, say 1.0.0.
  3. Merge that release commit into beta

At this point, Auto will rebuild that as if it's the next prerelease version, and tag it as 1.0.1-beta.0.

  1. Create a patch-level PR to the beta branch, and merge it.

Now, Auto will build that. Not seeing the existing v1.0.1-beta.0 tag because it only looks at tags after v1.0.0 and both are on the same commit, it will attempt to reuse v1.0.1-beta.0 as the next version number.

The build will then break with a duplicate Git tag error.

Configuration

  • Using 'npm' as Auto's release plugin
  • Running Node 14.x and Auto 10.32.2

Workaround

Manual git magic will be needed to work around it:

git tag --delete v1.0.1-beta.0
git push --delete origin v1.0.1-beta.0
git tag v1.0.1-beta.0 <the next commit after v1.0.0>
git push --tags

That commit won't be built, but the next commit after that will get 1.0.1-beta.1 as its version and get released.

rconnamacher avatar Oct 28 '21 22:10 rconnamacher