From fcdc9bc55031116f0e9f2347ab696e9927e7a7cc Mon Sep 17 00:00:00 2001 From: nea Date: Sat, 23 Sep 2023 01:50:41 +0200 Subject: Add description to github releases --- .../nea/libautoupdate/GithubReleaseUpdateData.java | 31 ++++++++++++++++++++++ .../libautoupdate/GithubReleaseUpdateSource.java | 9 +++++-- src/main/java/moe/nea/libautoupdate/Main.java | 2 +- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java diff --git a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java new file mode 100644 index 0000000..f1ebf74 --- /dev/null +++ b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateData.java @@ -0,0 +1,31 @@ +package moe.nea.libautoupdate; + +import com.google.gson.JsonElement; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +import java.util.Date; + +@Data +@ToString(callSuper = true) +@EqualsAndHashCode(callSuper = true) +public class GithubReleaseUpdateData extends UpdateData { + + String releaseDescription; + String targetCommittish; + Date createdAt; + Date publishedAt; + String htmlUrl; + + public GithubReleaseUpdateData(String versionName, JsonElement versionNumber, String sha256, String download, + String releaseDescription, String targetCommittish, + Date createdAt, Date publishedAt, String htmlUrl) { + super(versionName, versionNumber, sha256, download); + this.releaseDescription = releaseDescription; + this.targetCommittish = targetCommittish; + this.createdAt = createdAt; + this.publishedAt = publishedAt; + this.htmlUrl = htmlUrl; + } +} diff --git a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java index 38bfd86..9627365 100644 --- a/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java +++ b/src/main/java/moe/nea/libautoupdate/GithubReleaseUpdateSource.java @@ -64,11 +64,16 @@ public class GithubReleaseUpdateSource extends JsonUpdateSource { if (release.getAssets() == null) return null; return release.getAssets().stream() .filter(it -> (Objects.equals(it.getContentType(), "application/x-java-archive") || (it.getName() != null && it.getName().endsWith(".jar"))) && it.getBrowserDownloadUrl() != null) - .map(it -> new UpdateData( + .map(it -> new GithubReleaseUpdateData( release.getName() == null ? release.getTagName() : release.getName(), new JsonPrimitive(release.getTagName()), null, - it.getBrowserDownloadUrl() + it.getBrowserDownloadUrl(), + release.getBody(), + release.getTargetCommitish(), + release.getCreated_at(), + release.getPublishedAt(), + release.getHtmlUrl() )) .findFirst().orElse(null); } diff --git a/src/main/java/moe/nea/libautoupdate/Main.java b/src/main/java/moe/nea/libautoupdate/Main.java index de91b08..dc6c458 100644 --- a/src/main/java/moe/nea/libautoupdate/Main.java +++ b/src/main/java/moe/nea/libautoupdate/Main.java @@ -4,7 +4,7 @@ public class Main { public static void main(String[] args) { UpdateContext updater = new UpdateContext( - UpdateSource.mavenSource("https://repo.nea.moe/releases", "moe.nea", "neuhax"), + UpdateSource.githubUpdateSource("hannibal002", "SkyHanni"), UpdateTarget.deleteAndSaveInTheSameFolder(Main.class), CurrentVersion.ofTag("1.1.0"), "test" -- cgit