intuit / intuit/auto

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

Open
#2,102 1 comment 4 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
2.5k
Forks
221
PR merge metrics
No merged PRs in 30d

Description

**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`.

4. 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
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.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.