{"id":27770741,"url":"https://github.com/mfarsikov/kewt-versioning","last_synced_at":"2026-05-11T05:34:36.465Z","repository":{"id":47100492,"uuid":"263057534","full_name":"mfarsikov/kewt-versioning","owner":"mfarsikov","description":"Gradle plugin for versioning using Git tags","archived":false,"fork":false,"pushed_at":"2024-09-21T21:37:46.000Z","size":178,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-29T21:15:44.854Z","etag":null,"topics":["git","gradle","gradle-plugin","kotlin","plugin","semantic-versioning","tags","versioning"],"latest_commit_sha":null,"homepage":null,"language":"Kotlin","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/mfarsikov.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-05-11T13:55:50.000Z","updated_at":"2024-09-21T21:37:49.000Z","dependencies_parsed_at":"2024-08-26T20:51:25.487Z","dependency_job_id":null,"html_url":"https://github.com/mfarsikov/kewt-versioning","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfarsikov%2Fkewt-versioning","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfarsikov%2Fkewt-versioning/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfarsikov%2Fkewt-versioning/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mfarsikov%2Fkewt-versioning/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mfarsikov","download_url":"https://codeload.github.com/mfarsikov/kewt-versioning/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251582940,"owners_count":21612747,"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","gradle","gradle-plugin","kotlin","plugin","semantic-versioning","tags","versioning"],"created_at":"2025-04-29T21:15:48.103Z","updated_at":"2026-05-11T05:34:36.433Z","avatar_url":"https://github.com/mfarsikov.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"![gradlePluginPortal](https://img.shields.io/maven-metadata/v/https/plugins.gradle.org/m2/com/github/mfarsikov/kewt-versioning/com.github.mfarsikov.kewt-versioning.gradle.plugin/maven-metadata.xml.svg?label=gradle%20plugin%20portal\u0026style=flat-square\u0026color=blue)\n\u003cimg src=\"misc/kotlin-logo.svg\" alt=\"drawing\" width=\"20\"/\u003e\n\n# Kewt versioning Gradle plugin\ninspired by [Axion release plugin](https://github.com/allegro/axion-release-plugin)\n\nProject versioning using Git tags with type safe Gradle Kotlin DSL.\n\n## Quick start\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n\n`build.gradle.kts`\n\n```kotlin\nplugins {\n    id(\"com.github.mfarsikov.kewt-versioning\") version \"1.5.0\"\n}\nversion = kewtVersioning.version\n```                                   \n\u003c/details\u003e\n\n## Tasks\n* `currentVersion` prints current version.\n\n## Configuration\nThis is default configuration. It includes two pre-configured branches: `master` and all other (`.*`).\nOrder does matter. First matched config will be used.\n\n\u003cdetails open\u003e\n\u003csummary\u003eKotlin\u003c/summary\u003e\n`build.gradle.kts`:\n\n```kotlin\nimport com.github.mfarsikov.kewt.versioning.plugin.Incrementer\n\nkewtVersioning.configuration {\n    gitPath = project.rootDir  // default\n    prefix = \"v-\" // default\n    remoteName = \"origin\" // default\n    userName = \"\\${GITHUB_USER_NAME}\" // default\n    password = \"\\${GITHUB_PASSWORD}\" // default\n    versioning = SEMANTIC // default, can be INCREMENTAL\n    branches {\n        add {\n            regexes = mutableListOf(\"master\".toRegex())\n            incrementer = Incrementer.MINOR // default\n            stringify = stringifier(\n                useBranch = false,  // by default: true\n                useSnapshot = true, // default\n                useDirty = true, // default\n                useSha = false,  // by default: null\n                useTimestamp = false, // by default: null\n                timeZone = ZoneOffset.systemDefault() // Default\n            )\n        }\n        add {\n            regexes = mutableListOf(\".*\".toRegex())\n            stringify = stringifier(\n                useTimestamp = false,\n                useSha = false\n            )\n        }\n    }\n}\n```\n\u003c/details\u003e\n\n* `gitPath` - path to `.git` folder. Default is project root `gitPath=project.rootDir`.\n* `prefix` - is used for Git tags. By default `prefix=\"v-\"`. Tags look like \nthis: `v-0.0.1`. Submodules can use different tags to have independent versioning. \n* `remoteName` remote repository name. Default is `\"origin\"`. To prevent pushing tags to remote could be reset to `null`\n* `userName` and `password` used for HTTPS connection to remote repository. If value has prefix `${` and postfix `}` (string in Kotlin `\"\\${MY_PWD}\"`) it will be resolved from environment variables.\n Could contain plain values (highly not recommended). \n* `versioning` - could be one of `[SEMANTIC | INCREMENTAL]`. Semantic uses 3 digit version (`v-1.2.3`) whereas incremental only one (`v-1`)\n* `branches` - per branch configuration. By default, this list has two configurations: first matches master (or main) branch, the \nsecond matches rest of branches.\n  * `regexes` - list of regexes for branch names. Default is `mutableListOf(\"master\".toRegex(), \"main\".toRegex())`. Hint: to avoid a lot \n  of escape symbols use triple double-quotes in Kotlin\n  * `incrementer` - default incrementer for the matched branch. Default value is `Incrementer.Minor`. Could be Major, Minor, Patch. Each branch could have its own\n   default version increment strategy. Master and feature branches could increment their minor versions (0.1.0 -\u003e 0.2.0).\n   Release and fix branches could increment patch versions (0.1.0 -\u003e 0.1.1) \n  * `stringify` - version string configuration. Version name could include branch name, snapshot sign, dirty sign, \n  commit SHA signature and timestamp. There is a builder `smartVersionStringifier(useBranch, useSnapshot, useDirty, useSha, useTimestamp, timeZone)`, but if it is not \n  enough the `stringify` property is of `(DetailedVersion) -\u003e String` type, so **implementation could be provided in place**. \n  Like:\n  ```kotlin\n  stringify = { version: DetailedVersion -\u003e \"here-could-be-your-prefix-${version.sha}\"}\n  ``` \n\n### Stringifier\nThis function is responsible for creating string version generator, that will be used in gradle script.\n\nParameters:\n* `useBranch` if true (default) version includes branch name\n* `useSnapshot` if true (default) and current commit is not tagged by version tag, then version includes `-SNAPSHOT` suffix\n* `useDirty` if true (default) and there are uncommitted changes, then version includes `-dirty` suffix\n* `useSha` if null (default) version includes commit SHA if it is a snapshot. If true version always includes commit SHA\n* `useTimestamp` if null (default) version includes timestamp if it is dirty. If true version always includes timestamp\n* `timeZone` time zone used in timestamp. Default value is UTC.\n\n\u003cdetails\u003e\n\u003csummary\u003eExamples for configurations and output\u003c/summary\u003e \n\n(SHA is shortened for brevity)\n\n|                                         | Released (the tag is present on current commit)           | Snapshot (current commit is ahead of tag)                                 | Dirty (uncommitted changes)                                                                         |\n|---------                                |--------------                                             |-----------------------------------------------------------                |--------------------------------------------------------------------------------|\n| default                                 | `0.4.0-master`                                            | `0.4.0-master-SNAPSHOT-dbef6a`                                            | `0.4.0-master-SNAPSHOT-dbef6a-dirty-2020-05-16T20-34-46.771`|\n| `useBranch = false`                     | `0.4.0`                                                   | `0.4.0-SNAPSHOT-dbef6a`                                                   | `0.4.0-SNAPSHOT-dbef6a-dirty-2020-05-16T20-34-46.771`       |\n| `useSnapshot = false`                   | `0.4.0-master`                                            | `0.4.0-master-dbef6a`                                                     | `0.4.0-master-dbef6a-dirty-2020-05-16T20-34-46.771`         |\n| `useDirty = false`                      | `0.4.0-master`                                            | `0.4.0-master-SNAPSHOT-dbef6a`                                            | `0.4.0-master-SNAPSHOT-dbef6a-2020-05-16T20-34-46.771`      |\n| `useSha = true`                         | `0.4.0-master-dbef6a`                                     | `0.4.0-master-SNAPSHOT-dbef6a`                                            | `0.4.0-master-SNAPSHOT-dbef6a-2020-05-16T20-34-46.771`      |\n| `useTimestamp = true`                   | `0.4.0-master-2020-05-16T20-34-46.771` | `0.4.0-master-SNAPSHOT-dbef6a-2020-05-16T20-34-46.771` | `0.4.0-master-SNAPSHOT-dbef6a-2020-05-16T20-34-46.771`      |\n| `useTimestamp = false, useSha = false`  | `0.4.0-master`                                            | `0.4.0-master-SNAPSHOT`                                                   | `0.4.0-master-SNAPSHOT-dirty`                                                  |\n\u003c/details\u003e\n\n### Incremental versioning\nIf there is no need to use complex major/minor/patch semantic versioning, INCREMENTAL versioning can be configured. In this case version consist of a single number, and it is treated as `major` one.\n\n### Usage example\n* Kewt versioning plugin is versioned by kewt versioning plugin (see `build.gradle.kts`)\n* Using in multiproject build: https://github.com/mfarsikov/kewt\n* https://github.com/mfarsikov/kotlite\n* https://github.com/mfarsikov/kotgres\n\n### Compatibility\n\n| kewt versioning | JVM | Gradle |\n|-----------------|-----|--------|\n| v-1.0.0         | 17  | 7.5    |\n| v-1.2.0         | 21  | 8.10   |","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfarsikov%2Fkewt-versioning","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmfarsikov%2Fkewt-versioning","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmfarsikov%2Fkewt-versioning/lists"}