tschulte / gradle-semantic-release-plugin

Gradle implementation of semantic release (https://github.com/semantic-release/semantic-release)
Apache License 2.0
88 stars 11 forks source link

Error when git repository has no commits #25

Open grv87 opened 6 years ago

grv87 commented 6 years ago

Suppose that you just created directory, run git init and wrote simple build script that uses semantic-release plugin. Running it could give you an exception:

* What went wrong:
No commit found for revision string: HEAD

Demo build script (don't forget to do git init) and stacktrace: https://gist.github.com/grv87/1b445bf9daf81bd3f6764ff8c0ef2dde

The problem arises only when some other part of build script tries to use version property. Plugin then throws an error.

Semver FAQ recommends to start development with 0.1.0 version, so it could be used as start.

tschulte commented 6 years ago

I think this is related to #24. Internally my plugin uses the gradle-git plugin. I will have a look at this.

Semver FAQ recommends to start with 0.1.0, but it also says, that there are no guarantees about backwards compatibility until version 1.0.0 is reached. Therefore in semantic-release the first version to be released is 1.0.0. Even if that means that version 2.0.0 and 3.0.0 will come soon.

With that said, the first version must always be 1.0.0(-SNAPSHOT)

grv87 commented 6 years ago

I agree with you about 1.0.0 for now. But there is an open discussion about dropping this rule: https://github.com/mojombo/semver/issues/221

tschulte commented 6 years ago

Thank you very much for that link. I didn't know that. I will give a talk at http://javaland.eu about semantic-release (using this plugin, of course). I will incorporate that info.

grv87 commented 6 years ago

Also I suspect there is a problem when remote refers to local directory. Although, I haven't tested it yet.