Skip to content

feat(snapshot): auto version via mill.util.VcsVersion (sbt-dynver parity) - #4279

Open
987Nabil wants to merge 1 commit into
v4.xfrom
vcs-version
Open

feat(snapshot): auto version via mill.util.VcsVersion (sbt-dynver parity)#4279
987Nabil wants to merge 1 commit into
v4.xfrom
vcs-version

Conversation

@987Nabil

@987Nabil 987Nabil commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #4277: replace hardcoded 4.0.0-SNAPSHOT with auto version via mill.util.VcsVersion (Mill built-in, no extra deps), matching sbt-dynver / sbt-ci-release on main.

Closes gap noted after merge: version should be generated, not manual.

Changes

build.mill

  • Add import mill.util.VcsVersion (bundled in mill-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:
    • lastTag v4*/4.* → standard dynver: tag on exact → release (4.0.0), distance → 4.0.0-2-gabc123-SNAPSHOT
    • lastTag v3*/3.* → constant 4.0.0-SNAPSHOT (no v4 tag yet on v4.x; avoids publishing 3.11.4-...-SNAPSHOT for v4 code)
    • None4.0.0-SNAPSHOT (shallow clone / jj workspace without .git)
    • Task.Input + copy(dirtyHash=None) when CI env (parity with Mill's own build.mill and reviewer feedback: avoids stale cache, clean CI version)

.github/workflows/snapshot.yml

  • fetch-tags: true (ensure v* tags visible to VcsVersion.calcVcsState; required after switching to dynver — reviewer noted fetch-depth: 50 would 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.publishVersion4.0.0-SNAPSHOT (jj workspace, no .git fallback; also case for v3 tag)
  • 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 → SUCCESS
  • MILL_TESTS_PUBLISH_DRY_RUN still works (version feeds SonatypeCentralPublishModule routing to central.sonatype.com/repository/maven-snapshots)

Future

Once first v4 tag (v4.0.0 / v4.0.0-RC1) is cut, snapshots automatically become v4.0.0-1-g...-SNAPSHOT via same path — no further build.mill change needed. Exact tag → release without -SNAPSHOT (Central Releases).

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant