*
* @Return a string to represent the version to update; null if there is
* no version to update
*/
public static String fetchVersionToUpdate() throws GitAPIException {
Version current = Version.valueOf(Config.semverize(Config.getCurrentVersion()));
Version latest = current;
boolean isUpdateRequired = false;
Collection<Ref> refs;
refs = Git.lsRemoteRepository()
.setRemote(UPDATE_REPOSITORY_URL)
.setHeads(false)
.setTags(true)
.call();
for(Ref ref : refs) {
String tag = ref.getName().replaceFirst("^refs/tags/", "");
if (tag.charAt(0) == 'v') {
String versionString = Config.semverize(tag);
try {
Version ver = Version.valueOf(versionString);
if (ver.greaterThan(latest)) {
isUpdateRequired = true;
latest = ver;
}
} catch (UnexpectedElementTypeException e) {
play.Logger.warn("Failed to parse a version: " +