Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.51 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.51 KB

GitHub Version Checker

GitHub release (latest by date) GitHub all releases GitHub

A java library for checking for new releases on GitHub

Download

This library is published as com.lezurex.github-version-checker on GitHub Packages. Take a look at this to see how to configure the GitHub Package Registry for your project.

Usage

public class Example {

    public static void main(String[] args) {
        ReleaseVersion currentVersion = new ReleaseVersion("v1.0.0");
        GithubVersionChecker versionChecker = new GithubVersionChecker("Lezurex", "github-version-checker", currentVersion);

        CheckResult result = versionChecker.check();
        switch (result.getVersionState()) {
            case NEWER:
                System.out.println("You are on a development branch, aren't you?");
                break;
            case OUTDATED:
                System.out.printf("Your current version is outdated! %s is available here: %s", result.getVersion(), result.getPageLink());
                break;
            case UP_TO_DATE:
                System.out.println("Your current version is up to date!");
                break;
        }

    }

}