{"id":27116800,"url":"https://github.com/rising3/semver-gradle-plugin","last_synced_at":"2025-04-07T05:52:39.166Z","repository":{"id":45027501,"uuid":"349668080","full_name":"rising3/semver-gradle-plugin","owner":"rising3","description":"Gradle plugin for Updates the project version.A plugin that can updating the semantic versions like `yarn version` command.","archived":false,"fork":false,"pushed_at":"2023-01-22T00:21:38.000Z","size":322,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-24T14:27:35.166Z","etag":null,"topics":["cd","ci","conventional-commits","git","gradle","gradle-plugin","release","semantic","semantic-versioning","semver","version","versioning","yarn"],"latest_commit_sha":null,"homepage":"","language":"Groovy","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/rising3.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-03-20T08:25:54.000Z","updated_at":"2023-03-11T22:17:51.000Z","dependencies_parsed_at":"2023-02-12T13:47:40.208Z","dependency_job_id":null,"html_url":"https://github.com/rising3/semver-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rising3%2Fsemver-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rising3%2Fsemver-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rising3%2Fsemver-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rising3%2Fsemver-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rising3","download_url":"https://codeload.github.com/rising3/semver-gradle-plugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247601481,"owners_count":20964864,"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":["cd","ci","conventional-commits","git","gradle","gradle-plugin","release","semantic","semantic-versioning","semver","version","versioning","yarn"],"created_at":"2025-04-07T05:52:38.128Z","updated_at":"2025-04-07T05:52:39.130Z","avatar_url":"https://github.com/rising3.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# semver-gradle-plugin\n[![BUILD](https://github.com/rising3/semver-gradle-plugin/actions/workflows/build.yml/badge.svg)](https://github.com/rising3/semver-gradle-plugin/actions/workflows/build.yml)\n[![Gradle plugin portal](https://img.shields.io/gradle-plugin-portal/v/com.github.rising3.semver?label=Gradle%20plugin%20portal\u0026color=blue)](https://plugins.gradle.org/plugin/com.github.rising3.semver)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org)\n[![Join the chat at https://gitter.im/semver-gradle-plugin/community](https://badges.gitter.im/semver-gradle-plugin/community.svg)](https://gitter.im/semver-gradle-plugin/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge\u0026utm_content=badge)\n\nGradle plugin for Updates the project version.\nA plugin that can updating the semantic versions like `yarn version` command.\n\n**Prerequisites:**\n\n* Java 8 or higher\n* Gradle 6.x or higher\n\n## Installation\n\nYou need to add the following lines to your `build.gradle` file:\n\n```\nplugins {\n    id 'com.github.rising3.semver' version '\u003clatest version from the Gradle plugin portal\u003e'\n}\n```\n\n[More...](https://plugins.gradle.org/plugin/com.github.rising3.semver)\n\n## New features\n\n* Add supported for dry-run. [More...](#task-options)\n* Add supported for an automating generate a changelog with the ConventionalCommits. [More...](#changelog)\n* Add supported for an automating versioning with the ConventionalCommits. [More...](#task-options)\n* Add supported for a get current version from the latest tag. [More...](#plugin-extension)\n\n## Updating versions\n\nUsing the `semver` gradle plugin you can update the version of your package via the gradle task.\n\nFor example,starting with this `gradle.properties` file:\n\n``` properties\nversion=1.0.1\n```\n\nWhen we run the `semver` task:\n```\ngradle semver\n```\n\nquestion New version.\n```\ninfo Current version: 1.0.1\nquestion New version: 1.0.2\n\n\u003e Task :semver\n\n...\n\ninfo New version: 1.0.2\n```\n\nWe will get this updated `gradle.properties` file:\n\n``` properties\nversion=1.0.2\n```\n\n\u003e **Note:** The new version you enter must be a valid [SemVer](https://classic.yarnpkg.com/en/docs/dependency-versions#toc-semantic-versioning) version.\n\n## Plugin Tasks\n\nA plugin consists of the following tasks.\n\n### Latest\n\n```\ngradle semverLatest\n```\nResolve a current version from the latest FILE, or TAG.\n\n**DependsOn:** jar\n\n### Semver\n\n```\ngradle semver\n```\n\nA plugin that can updating the semantic versions like `yarn version` command.\nOther than that, it now supports conventional commits, so you can automate your releases.\n\n**DependsOn:** check, semverLatest\n\n### Task options\n\n```\ngradle semver\n```\n\nCreate a new version using an interactive session to prompt you for a new version.\n\n```\ngradle semver --new-version \u003cversion\u003e\n```\n\nCreates a new version specified by `\u003cversion\u003e`.\n\n```\ngradle semver --major\ngradle semver --minor\ngradle semver --patch\n```\n\nCreates a new version by incrementing the major, minor, or patch number of the current version.\n\n```\ngradle semver --premajor\ngradle semver --preminor\ngradle semver --prepatch\n```\n\nCreates a new prerelease version by incrementing the major, minor, or patch number of the current version and adding a prerelease number.\n\n```\ngradle semver --prerelease\n```\n\nIncrements the prerelease version number keeping the main version.\n\n```\ngradle semver [--premajor | --preminor | --prepatch |--prerelease ] --preid \u003cpre-identifier\u003e\n```\n\nAdds an identifier specified by \u003cpre-identifier\u003e to be used to prefix premajor, preminor, prepatch or prerelease version increments.\n\n```\ngradle semver --conventional-commits\n```\nCreate a new version according to the Conventional Commits rules.\nIt refers to the commit log since the last release and creates a new version based on the following rules.\n\nThe commit message should be structured as follows:\n\n```text\n\u003ctype\u003e[optional scope]: \u003cdescription\u003e\n\n[optional body]\n\n[optional footer(s)]\n```\n* **fix**: a commit the type `fix` patches a bug in your codebase (this correlates with `--patch` option).\n* **feat**: a commit the type `feat` introduces a new feature to the codebase (this correlates with `--minor` option).\n* **BREAKING CHANGE**: a commit that has a footer `BREAKING CHANGE:`, or appends a `!` after the type/scope, introduces a breaking API change (correlating with `--major` option). A BREAKING CHANGE can be part of commits of any type.\n* Types other than `fix` and `feat` are allowed, but an automating versioning is not supported.\n\nFor more information, please refer to [ConventionalCommits](https://www.conventionalcommits.org/en/v1.0.0/)\n\n```\ngradle semver --conventional-commits --dryrun\n```\nDry run the options.\nIn a dry run, the following operations will be disabled.\n* local/remote Git operations (git add, git commit, git tag, git push)\n* GitHub release operations\n\n## Plugin Extension\n\nThe plugin defines an extension with the namespace `semver`. The following properties can be configured:\n\nProperty Name | Type | Default value | Description\n--- | --- | --- | ---\ntarget | String | 'FILE' | Choice 'FILE' or 'TAG'.\nversionTagPrefix | String | 'v' | Change the prefix of the git tag.\nversionGitMessage | String | 'v%s' | Change the git message. Where %s is the version string.\nchangeLog | String | 'NONE' | Choice 'NONE' or FILE' or 'GITHUB' or 'BOTH'.\nchangeLogZoneId | String | 'UTC' | Choice the zone id supported by the ZoneId class.\nchangeLogOrder | String[] | | Change type order.\nchangeLogType | String[] | | Change type title.\nnoBackupChangelog | boolean | true | Even enable or disable the create the CHANGELOG.bak behavior entirely.\nnoBackupProp | boolean | true | Even enable or disable the create the gradle.properties.bak behavior entirely.\nnoBackupPackageJson | boolean | true | Even enable or disable the create the package.json.bak behavior entirely.\nnoGitStatusCheck | boolean | false | Even enable or disable the git status check behavior entirely.\nfilename | String | 'gradle.properties' | (FILE Only)\u003cBR\u003eChange the filename of\u0026nbsp;version\u0026nbsp;property.\nnoGitCommand | boolean | false | (FILE Only)\u003cBR\u003eEven enable or disable the git command behavior entirely.\nnoGitInit | boolean | true | (FILE Only) \u003cBR\u003eEven enable or disable the git init behavior entirely.\nnoGitCommitVersion | boolean | false | (FILE Only) \u003cBR\u003eEven enable or disable the git commit behavior entirely.\nnoGitTagVersion | boolean | false | (FILE Only) \u003cBR\u003eEven enable or disable the git tagging behavior entirely.\nnoGitPush | boolean | true | (FILE Only) \u003cBR\u003eEven enable or disable the git push branch behavior entirely.\nnoGitPushTag | boolean | true | (FILE Only) \u003cBR\u003eEven enable or disable the git push tag behavior entirely.\nnoPackageJson | boolean | false | (FILE Only) \u003cBR\u003eEven enable or disable the versioning the package.json behavior entirely.\n\n**FILE:**\n1. Get current version from file. (gradle.properties, package.json, etc.)\n2. Update to new version, save to file.\n3. Create a git commit of save file.\n4. Create a git tag of new version.\n\n**TAG:**\n1. Get latest tag for git.\n2. Analyze tag, convert to semantic version.(current version)\n3. Update to new version, save to file.\n4. Create a git tag of new version.\n5. Push tag to remote.\n\nGIT CONTROL | FILE(DEFAULT) | TAG(DEFAULT)\n--- | --- | ---\nCREATE(UPDATE) VERSION FILES |  Y | Y\nCREATE VERSION COMMIT | Y | N\nCREATE VERSION TAG | Y | Y\nPUSH COMMIT | N | N\nPUSH TAG | N | Y\n\n### Example\n\nFor example, add with this `build.gradle` file:\n\n``` groovy\nsemver {\n    target = 'file'\n    versionTagPrefix = 'v'\n    versionGitMessage = 'v%s'\n    noGitInit = false\n    noGitCommand = false\n    noGitTagVersion = false\n    noGitPush = false\n    noGitPushTag = false\n    noPackageJson = true\n}\n```\n## Authentication\n\n### Push access to the remote repository\n\n**semver-gradle-plugin**\nrequires push access to the project Git repository in order to create git branch or git tag.\n\nThe Git authentication can be set with one of the following environment variables:\n\nVariables | Description\n--- | ---\n`GH_ACTOR` `GH_TOKEN` or `GITHUB_ACTOR` `GITHUB_TOKEN` | A GitHub [personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line).\n`GL_ACTOR` `GL_TOKEN` or `GITLAB_ACTOR` `GITLAB_TOKEN` | A GitLab [personal access token](https://docs.gitlab.com/ce/user/profile/personal_access_tokens.html).\n`BB_ACTOR` `BB_TOKEN` or `BITBUCKET_ACTOR` `BITBUCKET_TOKEN` | A Bitbucket [personal access token](https://confluence.atlassian.com/bitbucketserver/personal-access-tokens-939515499.html).\n\nor the following system properties:\n\nSystem properties | Description\n--- | ---\n`gh.actor` `gh.token` or `github.actor` `github.token` |\n`gl.actor` `gl.token` or `gitlab.actor` `gitlab.token` |\n`bb.actor` `bb.token` or `bitbucket.actor` `bitbucket.token` |\n\nHere is an example of what a `gradle.properties` file:\n\n**~/.gradle/gradle.properties**\n```properties\nsystemProp.gh.actor=xxx\nsystemProp.gh.token=xxx\n```\n\n## Changelog\n\nA new version of the changelog can be generated automatically.\nThe changelog will be generated from the Git commit log of the previous release or later.\n\nIt also supports the following:\n* Markdown format\n* ConventionalCommits\n* GitHub Releases\n\nFor example, add with this `build.gradle` file:\n\n``` groovy\nsemver {\n    changeLog = 'FILE'\n}\n```\n* **`NONE`**: Do nothing (default)\n* **`FILE`**: Write the changelog to a file (CHANGELOG.md)\n* **`GITHUB`**: Upload the changelog to GitHub Releases\n* **`BOTH`**: Both `FILE` and `GITHUB`\n\n### Change the type order\n\nFor example, add with this `build.gradle` file:\n\n```groovy\nsemver {\n    changeLogOrder = [\n            '__breaking_change__',\n            'feat',\n            'fix',\n    ]\n}\n\n```\n### Change the type title\n\nFor example, add with this `build.gradle` file:\n\n```groovy\n\nsemver {\n    changeLogTitle = [\n            build              : 'Build Improvements',\n            chore              : 'Chores',\n            ci                 : 'CI Improvements',\n            docs               : 'Documentation',\n            feat               : 'New Features',\n            fix                : 'Bug Fixes',\n            perf               : 'Performance Improvements',\n            refactor           : 'Code Refactoring',\n            style              : 'Styles',\n            test               : 'Tests',\n            __breaking_change__: '!!! BREAKING CHANGES !!!',\n            __undefined__      : 'Other Changes',\n    ]\n}\n```\n\n## Git tags\n\nif you run `semver` task within a Git repository an annotated Git tag will be created by default following the format `v0.0.0`.\n\nYou can customize the git tag that is created or disable this behavior by using `semver extension`.\n\nFor example, add with this `build.gradle` file:\n\n``` groovy\nsemver {\n    // To change the prefix of the git tag you can use versionTagPrefix:\n    versionTagPrefix = 'v'\n\n    // Or you can change the git message using versionGitMessage where %s is the version string:\n    versionGitMessage = 'v%s'\n\n    // You can even enable or disable the git tagging behavior entirely by using noGitTagVersion:\n    noGitTagVersion = false\n\n    // You can even enable or disable the git command behavior entirely by using noGitCommand:\n    noGitCommand = false\n}\n```\n\n## Supported for package.json\n\nCASE | gradle.properties | package.json\n--- | --- | ---\nNot exists | CREATE | -\ngradle.properties exists | UPDATE | -\npackage.json exists | - | UPDATE\ngradle.properties,\u003cBR\u003epackage.json exists| UPDATE | UPDATE\n\n\n## Version lifecycle methods\n\nThe `semver` task runs based on [Gradle build lifecycle](https://docs.gradle.org/current/userguide/build_lifecycle.html).\n\nYou can use the following mechanism of Gradle to execute another task before and after executing the `semver` task.\n\n* dependsOn\n* reconfigure\n\nExecuting the `semver` task overrides `project.version`, e.g. `project.version` will in the doFirst() hold the version before the version change, and in the doLast() it will hold the version after the version change.\n\nHere is an example of what a `build.gradle` file:\n\n``` groovy\ntasks.semver.dependsOn test\n\ntasks.semver.configure {\n    doFirst {\n        println \"doFirst preversion: $project.version\"\n    }\n    doLast {\n        println \"doLast postversion: $project.version\"\n    }\n}\n```\n\nExecuted `semver` task would look something like this:\n\n```\ninfo Current version: 0.1.1\nquestion New version:  (default: 0.1.1): 0.1.2\n\n\n\u003e Task :semver\ndoFirst preversion: 0.1.1\ninfo New version: 0.1.2\ndoLast postversion: 0.1.2\n```\n\n## Building from source\n\nYou don’t need to build from source to use `semver-gradle-plugin`, but if you want to try out the latest, `semver-gradle-plugin`  can be built and published to your local Maven cache using the Gradle wrapper.\n\nYou also need following to:\n\n* Java 11 or higher\n* Gradle 7.x or higher\n\n```\n$ ./gradlew publishToMavenLocal\n```\n\nIf you want to build everything, use the build task:\n\n```\n$ ./gradlew build\n```\n\n## License\n\nThe `semver` gradle plugin is released under version 2.0 of the [Apache License](/LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frising3%2Fsemver-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frising3%2Fsemver-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frising3%2Fsemver-gradle-plugin/lists"}