{"id":17280814,"url":"https://github.com/lefou/mill-vcs-version","last_synced_at":"2025-07-05T16:33:23.754Z","repository":{"id":40426901,"uuid":"274148258","full_name":"lefou/mill-vcs-version","owner":"lefou","description":"Mill plugin to derive a version from (last) git tag and edit state","archived":false,"fork":false,"pushed_at":"2025-01-20T21:08:46.000Z","size":190,"stargazers_count":14,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T23:02:19.549Z","etag":null,"topics":["git","mill","mill-plugin","scala","vcs"],"latest_commit_sha":null,"homepage":"","language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lefou.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"lefou"}},"created_at":"2020-06-22T13:43:01.000Z","updated_at":"2025-01-20T21:08:49.000Z","dependencies_parsed_at":"2024-05-06T07:44:24.933Z","dependency_job_id":"61556a34-9326-4a20-b2d4-7cfb1d8df8b6","html_url":"https://github.com/lefou/mill-vcs-version","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefou%2Fmill-vcs-version","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefou%2Fmill-vcs-version/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefou%2Fmill-vcs-version/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lefou%2Fmill-vcs-version/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lefou","download_url":"https://codeload.github.com/lefou/mill-vcs-version/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248855960,"owners_count":21172673,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","mill","mill-plugin","scala","vcs"],"created_at":"2024-10-15T09:22:03.924Z","updated_at":"2025-04-14T09:42:01.950Z","avatar_url":"https://github.com/lefou.png","language":"Scala","funding_links":["https://github.com/sponsors/lefou"],"categories":[],"sub_categories":[],"readme":"= mill-vcs-version - Derive a version from Version Control\n:version: 0.4.1\n:mill-platform: 0.11\n:project-home: https://github.com/lefou/mill-vcs-version\n:toc:\n:toc-placement: preamble\n\nifdef::env-github[]\nimage:https://github.com/lefou/mill-vcs-version/workflows/.github/workflows/build.yml/badge.svg[\"Build Status (GitHub Actions)\", link=\"https://github.com/lefou/mill-vcs-version/actions\"]\nimage:https://codecov.io/gh/lefou/mill-vcs-version/branch/main/graph/badge.svg[Test Coverage (Codecov.io), link=\"https://codecov.io/gh/lefou/mill-vcs-version\"]\nimage:https://index.scala-lang.org/lefou/mill-vcs-version/de.tobiasroeser.mill.vcs.version/latest-by-scala-version.svg?platform=mill{mill-platform}[\"Latest version (Scaladex)\", link=\"https://index.scala-lang.org/lefou/mill-vcs-version/de.tobiasroeser.mill.vcs.version\"]\nendif::[]\n\nMill plugin to derive a version from (last) git tag and edit state.\nIt may support other VCS as well.\n\n== Quickstart\n\nTo use a git-derived version for publishing, all you need is to use `VcsVersion.vcsState` target.\n`VcsVersion` is an external mill module and as such can be used out of the box without further configuration.\n\n[source,scala,subs=\"attributes,verbatim\"]\n----\nimport mill._\nimport mill.scalalib._\nimport mill.define._\n\n// Load the plugin from Maven Central via ivy/coursier\nimport $ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::{version}`\nimport de.tobiasroeser.mill.vcs.version.VcsVersion\n\nobject main extends JavaModule with PublishModule {\n  override def publishVersion: T[String] = VcsVersion.vcsState().format()\n}\n----\n\n== Formatting options\n\nThe formatted version is base on\n\n* the latest git tag\n* the count of commits since the latest tag\n* the difference between the latest commit and the actual local state (changes or new files)\n\nThe format is highly customizable.\n\n----\n{git-tag}{commit-count-sep}{commit-count}{revision-sep}{revision-hash}{dirty-dep}{dirty-hash}\n----\n\nThe `format` method has the following options:\n\n* `noTagFallback: String = \"0.0.0\"` - will be used when no tag was found\n* `countSep: String = \"-\"` - will be printed before the commit count when it is greater than zero\n* `commitCountPad: Byte = 0` - if greater than zero, the commit count will be padded to the given length; a negative value results in never adding the commit count\n* `revSep: String = \"-\"` - will be printed before the revision hash if it is not a tagged revision\n* `revHashDigits: Int = 6` - the number of digits to be used for the revision hash\n* `dirtySep: String = \"-DIRTY\"` - will be printed before the dirty hash if the local repository is in modified state\n* `dirtyHashDigits: Int = 8` - the number of digits to be used for the dirty hash\n* `tagModifier: String =\u003e String` - allows to modify the git tag (By default this strips a leading `v` if one exists. e.g. v1.2.3 -\u003e 1.2.3)\n* `untaggedSuffix: String = \"\" - will append the given string at the end of the version when the current revision is not tagged (e.g. use with `\"-SNAPSHOT\"` to publish to Maven Snapshot repositories)\n\nWhen used with its defaults, the outcome is identical to the version scheme used by Mill.\n\n== Download\n\nYou can download binary releases from\nhttps://search.maven.org/artifact/de.tototec/de.tobiasroeser.mill.vcs.version_mill{mill-platform}_2.13[Maven Central].\n\n\nPlease make sure to use the correct _mill platform suffix_ matching your used mill version.\n\n.Mill Platform suffix\n[options=\"header\"]\n|===\n| mill version  | mill platform | suffix | example\n| 0.11.x - 0.12.x | 0.11 | `_mill0.11` | ```$ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::{version}````\n| 0.10.x | 0.10 | `_mill0.10` | ```$ivy.`de.tototec::de.tobiasroeser.mill.vcs.version::{version}````\n| 0.9.3 - 0.9.9      | 0.9 | `_mill0.9` | ```$ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.9:{version}````\n| 0.7.0 - 0.8.0 | 0.7 | `_mill0.7` | ```$ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.7:{version}````\n| 0.6.0 - 0.6.3 | 0.6 | `_mill0.6` | ```$ivy.`de.tototec::de.tobiasroeser.mill.vcs.version_mill0.6:{version}````\n|===\n\n== Caveats and Known Issues\n\n=== Limited git history in CI / Github Actions\n\nIf you witness confusing behavior in a CI environment, it's likely due to limited git history.\n\nE.g. on Github, the default setup for `action/checkout` fetches only 50 commit back from the current version. That means, once your last tag is older than that, you will get strange version numbers, probably starting with `0.0.0`.\n\nSo, in your CI setup, make sure to:\n\n* git checkout the complete history\n* git checkout all tags\n\nFor Github Actions, make sure all instances of `action/checkout` use the following setup.\n\n[source,yaml]\n----\n      - uses: actions/checkout@v4\n        with:\n          fetch-depth: 0\n          # next line is redundant as it's the default\n          fetch-tags: true \n----\n\n== License\n\nThis project is published under the https://www.apache.org/licenses/LICENSE-2.0[Apache License, Version 2.0].\n\n\n== About\n\nMill::\n  https://github.com/com-lihaoyi/mill[Mill] is a Scala-based open source build tool.\n  In my opinion the best build tool for the JVM.\n  It is fast, reliable and easy to understand.\n\nMe::\n+\n--\nhttps://github.com/lefou/[I'm] a professional software developer and love to write and use open source software.\nI'm actively developing and maintaining Mill as well as https://github.com/lefou?utf8=%E2%9C%93\u0026tab=repositories\u0026q=topic%3Amill\u0026type=\u0026language=[several Mill plugins].\n\nIf you like my work, please star it on GitHub. You can also support me via https://github.com/sponsors/lefou[GitHub Sponsors].\n--\n\nContributing::\n  If you found a bug or have a feature request, please open a {project-home}/issues[new issue on GitHub].\n  I also accept {project-home}/pulls[pull requests on GitHub].\n\n\n== Releases / Changelog\n\n=== 0.4.1 - 2024-12-11\n\n* Made `VcsVersion.calcVcsState` public\n\n=== 0.4.0 - 2023-06-07\n\n* Support Mill 0.11\n* Dependency updates: Scala 2.13.11 / 2.12.18\n* Silence stderr output from git\n\n=== 0.3.1 - 2023-04-26\n\n* Added support for Mill 0.11.0-M8\n* Dependency updates: scala 2.13.10 / 2.12.17\n* Internal improvements\n\n=== 0.3.0 - 2022-09-28\n\n* Support omitting the commit count\n* Don't fail for projects not under version control\n* Added `VcsState.vcs` field to check for the current used version control system, if any\n* Commit to `EarlySemVer` version scheme\n* Updated dependencies and tools\n\n=== 0.2.0 - 2022-08-09\n\n* Version tags starting with a `v`-prefix are now properly stripped by default.\n\n=== 0.1.4 - 2022-01-17\n\n* Added support for mill 0.10.x\n\n=== 0.1.3 - 2022-01-14\n\n_For proper Mill 0.10 support, please use 0.1.4 or newer._\n\n* Added support for mill 0.10.0\n\n=== 0.1.2 - 2021-09-18\n\n* Added support for mill 0.10.0-M2\n* Improved error handling\n\n=== 0.1.1 - 2021-01-21\n\n* Fixed handling of repos without any (previous) tag\n\n=== 0.1.0 - 2020-12-01\n\n* Support for mill API 0.9.3\n* Introduce a new artifact name suffix (`_mill0.9` for mil 0.9.3) to support multiple mill API versions.\n\n=== 0.0.1 - 2020-06-22\n\n* Initial Release, intended for internal/test usage\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefou%2Fmill-vcs-version","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flefou%2Fmill-vcs-version","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flefou%2Fmill-vcs-version/lists"}