jgitver / jgitver-maven-plugin

maven core extension to automatically define versions using jgitver & git tags
https://jgitver.github.io/
Other
159 stars 42 forks source link

Building within Github Actions always results in snapshot #169

Closed alibabashack closed 2 years ago

alibabashack commented 2 years ago

Issue

version: 1.8.0 (from maven central)

usage context:

Problem description:

When building from an annotated git tag (detached head) within github actions CI, this always results in a - SNAPSHOT suffix version for me. The version number is picked up correctly from the tag. However, I expect a release version without SNAPSHOT.

For example see the following actions run: https://github.com/alibabashack/rxtx/runs/4606812319?check_suite_focus=true

In bullet

I expect version 2.4.0 instead of 2.4.0-SNAPSHOT.

When the version is calculated based on the same repository on my local ubuntu 20.04 machine (also in detached head state on the same tag) no SNAPSHOT suffix is added.

I do not see any configuration differences between the github action run and my local run. Still it results in two different outcomes. Any ideas?

Thanks a lot for this project. It is a huge help in order to DRY in the insane maven world.

alibabashack commented 2 years ago

I think I accidentally did not use an annotated tag. I will inveatigate first.

alibabashack commented 2 years ago

Ok, I really used an annotated tag. I was confused by the git options, but option -m implies -a, so this does not seem to be the issue here.

alibabashack commented 2 years ago

I found the problem: A misconfiguration of my github workflow. If your workflow is distributed across multiple build host, all of them have to checkout the repository with a fetch-depth of 0, of course. :)

McFoggy commented 2 years ago

Fine that you found your issue. It's the same with other CI (Jenkins for example) if you build on different nodes you have to checkout on all of them.