{"id":20428281,"url":"https://github.com/tomasbjerre/git-changelog-gradle-plugin","last_synced_at":"2025-04-05T23:07:28.556Z","repository":{"id":2455094,"uuid":"46189605","full_name":"tomasbjerre/git-changelog-gradle-plugin","owner":"tomasbjerre","description":"Automate changelog and versioning with conventional commits and Git.","archived":false,"fork":false,"pushed_at":"2025-03-16T15:02:50.000Z","size":704,"stargazers_count":83,"open_issues_count":9,"forks_count":17,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-29T22:09:10.470Z","etag":null,"topics":["changelog","conventional-changelog","conventional-commits","git","github","jira","semantic-"],"latest_commit_sha":null,"homepage":"https://plugins.gradle.org/plugin/se.bjurr.gitchangelog.git-changelog-gradle-plugin","language":"Java","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/tomasbjerre.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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":["tomasbjerre"]}},"created_at":"2015-11-14T19:50:29.000Z","updated_at":"2025-03-29T06:25:20.000Z","dependencies_parsed_at":"2024-10-18T16:34:26.212Z","dependency_job_id":"d1efd30f-b369-4849-845e-53600e671ab7","html_url":"https://github.com/tomasbjerre/git-changelog-gradle-plugin","commit_stats":null,"previous_names":[],"tags_count":125,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasbjerre%2Fgit-changelog-gradle-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasbjerre%2Fgit-changelog-gradle-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasbjerre%2Fgit-changelog-gradle-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomasbjerre%2Fgit-changelog-gradle-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomasbjerre","download_url":"https://codeload.github.com/tomasbjerre/git-changelog-gradle-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247411231,"owners_count":20934653,"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":["changelog","conventional-changelog","conventional-commits","git","github","jira","semantic-"],"created_at":"2024-11-15T07:24:58.681Z","updated_at":"2025-04-05T23:07:28.535Z","avatar_url":"https://github.com/tomasbjerre.png","language":"Java","funding_links":["https://github.com/sponsors/tomasbjerre"],"categories":[],"sub_categories":[],"readme":"# Git Changelog Gradle Plugin\n\nThis is a Gradle plugin for [Git Changelog Lib](https://github.com/tomasbjerre/git-changelog-lib).\n\nPublished to [plugins.gradle.org](https://plugins.gradle.org/plugin/se.bjurr.gitchangelog.git-changelog-gradle-plugin).\n\n| Version                  | Java Version |\n| ------------------------ | ------------ |\n| version \u003c 2.0.0          | 8            |\n| 2.0.0 \u003c= version \u003c 2.2.0 | 11           |\n| 2.2.0 \u003c= version         | 17           |\n\n## Usage\n\nThere is a complete running example [here](/git-changelog-gradle-plugin-example) and also with Kotlin DSL [here](/git-changelog-gradle-plugin-example-kotlin).\n\nThere are some more examples in the [build.gradle](https://github.com/tomasbjerre/git-changelog-gradle-plugin/blob/master/git-changelog-gradle-plugin-example/build.gradle).\n\nMore documentation can be found in the [Git Changelog Lib](https://github.com/tomasbjerre/git-changelog-lib).\n\nIt will use `master` branch by default, you can change that with something like `toRef = \"main\"`.\n\n### Default tasks\n\nThese tasks are configured when plugin is applied, no further configuration needed to use them.\n\n- `gitChangelogSemanticVersion` - Will set version in `gradle.properties` from [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).\n- `gitChangelog` - Will update `CHANGELOG.md` using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).\n\nYou can also set the property `setVersionConventional=true` that will trigger the `project.version` to be updated. The `gitChangelogSemanticVersion` will update the version to late if you are also publishing in the same invocation. Triggering the versioning with the property will set the version earlier so that it is correct in the publications. The properties that can be set are:\n\n```properties\n# Needs to be set\nsetVersionConventional=true\n\n# These can also be set, but they have defaults\nsuffixSnapshot=...\nsuffixSnapshotIfNotTagged=...\nmajorVersionPattern=...\nminorVersionPattern=...\npatchVersionPattern=...\nignoreTagsIfNameMatches=...\n```\n\n### `build.gradle`\n\n```groovy\nplugin {\n  id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version 'X'\n}\n\n// Optional config if you want to configure the changelog\ntask gitChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {\n templateContent.set(\"\"\"\n  // Template here!\n \"\"\");\n}\n\n// Optional config if you want to configure versioning\ntask gitChangelogVersionTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogSemanticVersionTask) {\n suffixSnapshot.set(true);\n majorVersionPattern.set(\"^[Bb]reaking\")\n minorVersionPattern.set(\"[Ff]eature\")\n patchVersionPattern.set(\"[Ff]ix\")\n}\n```\n\n### Template - Simple\n\n```hbs\nChangelog of ${projectDisplayName}.\n\n{{#tags}}\n## {{name}}\n {{#issues}}\n  {{#hasIssue}}\n   {{#hasLink}}\n### {{name}} [{{issue}}]({{link}}) {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}\n   {{/hasLink}}\n   {{^hasLink}}\n### {{name}} {{issue}} {{title}} {{#hasIssueType}} *{{issueType}}* {{/hasIssueType}} {{#hasLabels}} {{#labels}} *{{.}}* {{/labels}} {{/hasLabels}}\n   {{/hasLink}}\n  {{/hasIssue}}\n  {{^hasIssue}}\n### {{name}}\n  {{/hasIssue}}\n\n  {{#commits}}\n**{{{messageTitle}}}**\n\n{{#messageBodyItems}}\n * {{.}}\n{{/messageBodyItems}}\n\n[{{hash}}](https://github.com/{{ownerName}}/{{repoName}}/commit/{{hash}}) {{authorName}} *{{commitTime}}*\n\n  {{/commits}}\n\n {{/issues}}\n{{/tags}}\n```\n\n### Template - Semantic versioning from conventional commits\n\nIf you are using [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/):\n\n```shell\n\u003ctype\u003e[optional scope]: \u003cdescription\u003e\n\n[optional body]\n\n[optional footer(s)]\n```\n\nA changelog can be rendered (using [Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers)) like this:\n\n```hbs\n# Changelog\n\n{{#tags}}\n{{#ifReleaseTag .}}\n## [{{name}}](https://gitlab.com/html-validate/html-validate/compare/{{name}}) ({{tagDate .}})\n\n  {{#ifContainsType commits type='feat'}}\n### Features\n\n    {{#commits}}\n      {{#ifCommitType . type='feat'}}\n - {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitlab.com/html-validate/html-validate/commit/{{hashFull}}))\n      {{/ifCommitType}}\n    {{/commits}}\n  {{/ifContainsType}}\n\n  {{#ifContainsType commits type='fix'}}\n### Bug Fixes\n\n    {{#commits}}\n      {{#ifCommitType . type='fix'}}\n - {{#eachCommitScope .}} **{{.}}** {{/eachCommitScope}} {{{commitDescription .}}} ([{{hash}}](https://gitlab.com/html-validate/html-validate/commit/{{hashFull}}))\n      {{/ifCommitType}}\n    {{/commits}}\n  {{/ifContainsType}}\n\n{{/ifReleaseTag}}\n{{/tags}}\n```\n\n### Example - custom helpers\n\nYou can add your own helpers and use them in the template. There are also [built in Helpers](https://github.com/tomasbjerre/git-changelog-lib#Helpers).\n\n```groovy\napply plugin: \"se.bjurr.gitchangelog.git-changelog-gradle-plugin\"\n\nimport se.bjurr.gitchangelog.plugin.gradle.HelperParam;\nimport com.github.jknack.handlebars.Helper;\nimport com.github.jknack.handlebars.Options;\n\ntask gitChangelogTask(type: se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask) {\n  file.set(new File(\"CHANGELOG.md\"));\n  handlebarsHelpers.set([\n    new HelperParam(\"startsWith\", new Helper\u003cString\u003e() {\n      public Object apply(String from, Options options) throws IOException {\n        def s = options.hash['s']\n        if (from.matches(\"^\" + s + \".*\")) {\n          return options.fn(this);\n        } else {\n          return options.inverse(this);\n        }\n      }\n    }),\n    new HelperParam(\"firstLetters\", new Helper\u003cString\u003e() {\n      public Object apply(String from, Options options) throws IOException {\n        def number = new Integer(options.hash['number'])\n        return from.substring(0,number);\n      }\n    })\n  ])\n  templateContent.set(\"\"\"\n  {{#commits}}\n    {{#startsWith messageTitle s='feat'}}\n      Starts with feat: \"{{messageTitle}}\"\n      first 10 letters of hash is: {{firstLetters hash number='10'}}\n    {{/startsWith}}\n  {{/commits}}\n  \"\"\");\n}\n```\n\n### Get next release\n\nIt can also be used to get the next semantic version based on commits.\n\n```groovy\nbuildscript {\n repositories {\n  mavenCentral()\n  mavenLocal()\n }\n dependencies {\n  classpath 'se.bjurr.gitchangelog:git-changelog-lib:1.+'\n }\n}\n\ndef nextVersion = se.bjurr.gitchangelog.api.GitChangelogApi.gitChangelogApiBuilder()\n  .withSemanticMajorVersionPattern(\"^[Bb]reaking\")\n  .withSemanticMinorVersionPattern(\"[Ff]eature\")\n  .getNextSemanticVersion();\n\nprintln \"Next version:\" + nextVersion.toString();\nprintln \" Major:\" + nextVersion.getMajor();\nprintln \" Minor:\" + nextVersion.getMinor();\nprintln \" Patch:\" + nextVersion.getPatch();\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasbjerre%2Fgit-changelog-gradle-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomasbjerre%2Fgit-changelog-gradle-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomasbjerre%2Fgit-changelog-gradle-plugin/lists"}