git-changelog-maven-plugin icon indicating copy to clipboard operation
git-changelog-maven-plugin copied to clipboard

Changelog generation between last two tags/refs ?

Open laurentperez opened this issue 7 years ago • 1 comments

Hi Under jenkins using the git changelog lib, GIT_PREVIOUS_COMMIT / GIT_COMMIT properties can be resolved and passed as from/to references I have a use case where I want to generate the changelog, but outside of jenkins. I'd like to create a changelog between current master and the latest known tag, or between the latest tag and the previous one. I have looked into the code and only found a ZERO_COMMIT reference. It is possible to feed the the maven plugin with command line hashes given https://github.com/tomasbjerre/git-changelog-maven-plugin/blob/master/git-changelog-maven-plugin-example/pom.xml Does anyone have the magic git hashes diff command to get the two hashes usable in this diff scenario ? Thanks

laurentperez avatar Sep 13 '17 17:09 laurentperez

Should be no problem if you configure the pom like:

<execution>
	<id>GenerateGitChangelogCommits</id>
	<phase>generate-sources</phase>
	<goals>
		<goal>git-changelog</goal>
	</goals>
	<configuration>
		<file>CHANGELOG.md</file>
		<fromRef>${fromRef}</fromRef>
		<toRef>${toRef}</toRef>
	</configuration>
</execution>

And build like

mvn generate-sources -DfromRef=`git describe --abbrev=0 --tags` -DtoRef=master

See also: https://stackoverflow.com/questions/1404796/how-to-get-the-latest-tag-name-in-current-branch-in-git

tomasbjerre avatar Sep 13 '17 17:09 tomasbjerre