feat(snapshot): auto version via mill.util.VcsVersion (sbt-dynver parity) - #4279
Open
987Nabil wants to merge 1 commit into
Open
feat(snapshot): auto version via mill.util.VcsVersion (sbt-dynver parity)#4279987Nabil wants to merge 1 commit into
987Nabil wants to merge 1 commit into
Conversation
…ity)
Replace hardcoded 4.0.0-SNAPSHOT with git-derived version:
- Use mill.util.VcsVersion (bundled in Mill 1.1.7, no extra deps) to mimic sbt-dynver / sbt-ci-release on main
- publishVersion = Task.Input { env ZIO_HTTP_SNAPSHOT_VERSION or VcsVersion.calcVcsState.format(untaggedSuffix=-SNAPSHOT) }
- Handle v4.x branch where latest tag is still v3 (no v4 tag yet): fallback to 4.0.0-SNAPSHOT constant until first v4 tag exists; once v4 tag exists, use standard dynver (tag exact → release, distance → snapshot)
- Task.Input + CI dirtyHash handling (copy(dirtyHash=None) when CI) for cache correctness
- Snapshot workflow: fetch-tags: true (ensure v3/v4 tags visible to VcsVersion) and JDK_JAVA_OPTIONS env for OOM prevention
987Nabil
requested review from
jdegoes,
kyri-petrou and
vigoo
as code owners
September 1, 2026 14:24
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #4277: replace hardcoded
4.0.0-SNAPSHOTwith auto version viamill.util.VcsVersion(Mill built-in, no extra deps), matchingsbt-dynver/sbt-ci-releaseonmain.Closes gap noted after merge: version should be generated, not manual.
Changes
build.millimport mill.util.VcsVersion(bundled inmill-libs-util_3:1.1.7)ZioHttpPublishModule.publishVersion = Task.Input { sys.env.get("ZIO_HTTP_SNAPSHOT_VERSION").getOrElse { VcsVersion.calcVcsState.format(untaggedSuffix="-SNAPSHOT") } }with v4-aware fallback:lastTagv4*/4.*→ standard dynver:tagon exact → release (4.0.0), distance →4.0.0-2-gabc123-SNAPSHOTlastTagv3*/3.*→ constant4.0.0-SNAPSHOT(nov4tag yet onv4.x; avoids publishing3.11.4-...-SNAPSHOTfor v4 code)None→4.0.0-SNAPSHOT(shallow clone / jj workspace without.git)Task.Input+copy(dirtyHash=None)whenCIenv (parity with Mill's ownbuild.milland reviewer feedback: avoids stale cache, clean CI version).github/workflows/snapshot.ymlfetch-tags: true(ensurev*tags visible toVcsVersion.calcVcsState; required after switching to dynver — reviewer notedfetch-depth: 50would miss tags)env: JDK_JAVA_OPTIONS: -Xms4G -Xmx8G -XX:+UseG1GC ...(reviewer low-priority: prevents OOM for 18-artifact publish)Verification
mill show core.jvm.2_13_18.publishVersion→4.0.0-SNAPSHOT(jj workspace, no.gitfallback; also case forv3tag)ZIO_HTTP_SNAPSHOT_VERSION=9.9.9-SNAPSHOT mill --no-server show ...→9.9.9-SNAPSHOT(env override still works)mill mill.scalalib.scalafmt/checkFormatAll→ SUCCESSMILL_TESTS_PUBLISH_DRY_RUNstill works (version feedsSonatypeCentralPublishModulerouting tocentral.sonatype.com/repository/maven-snapshots)Future
Once first
v4tag (v4.0.0/v4.0.0-RC1) is cut, snapshots automatically becomev4.0.0-1-g...-SNAPSHOTvia same path — no furtherbuild.millchange needed. Exact tag → release without-SNAPSHOT(Central Releases).