Easy to use and lightweight api for notify about new release version from GitHub
This api works by getting releases versions via GitHub API, using link
https://api.github.com/repos/[REPOSITORY AUTHOR]/[REPOSITORY NAME]/releases"
.
The methods described in Method Summary, modify the values of the variables,
private static String version;
private static String repositoryURL;
coded in API. This API uses jsonSimple library to work, maven dependency is in Installation*. In case of errors with API please describe it in Issues.
Type | Method | Description |
---|---|---|
String | getVersion(String version) | Get the latest release version |
String | getRepository(String author, String repositoryName) | Get the author and repository name |
boolean | releaseCheck() | Gets state of latest release |
Message | Reason |
---|---|
[ERROR] Assign a version using getVersion(). Setting default value as FALSE. |
You need to specify a version of release |
[ERROR] Assign a repository URL using getRepository(). Setting default value as FALSE. |
You need to specify a repository and release |
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0 |
There is no releases in that repository |
public static void main(String[] args) {
getVersion("v2.0");
getRepository("boybacks", "xorencrypt");
if (releaseCheck()) {
System.out.println("There is no new versions");
}
else {
System.out.println("There is new version");
}
}
Add this to your maven project in pom.xml
file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Compile scope is very important If you don't want to add dependencies manually or by using external jar files:
<dependency>
<groupId>com.github.BoyBACKS</groupId>
<artifactId>releasesChecker-API</artifactId>
<version>v1.2.1</version>
<scope>compile</scope>
</dependency>
* For v1.2.1, adding jsonSimple dependency is not required:
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
Pull requests are always welcome. For bigger changes, please open an issue first to discuss what you would like to change.
- For now, we do not expect another versions.
Would you like to support my work? Click here how you would like to do it!