Write snapshot build info inside properties and check for snapshots updates too
This commit is contained in:
@@ -21,6 +21,11 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Add build info
|
||||
env:
|
||||
WORKFLOW_RUN: ${{ github.run_number }}
|
||||
run: |
|
||||
echo "build=$WORKFLOW_RUN" >> assets/configs/app.properties
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build JAR dist files
|
||||
@@ -81,6 +86,11 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Add build info
|
||||
env:
|
||||
WORKFLOW_RUN: ${{ github.run_number }}
|
||||
run: |
|
||||
echo "build=$WORKFLOW_RUN" >> assets/configs/app.properties
|
||||
- name: Build JAR dist files
|
||||
env:
|
||||
WORKFLOW_RUN: ${{ github.run_number }}
|
||||
@@ -119,6 +129,11 @@ jobs:
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: 17
|
||||
- name: Add build info
|
||||
env:
|
||||
WORKFLOW_RUN: ${{ github.run_number }}
|
||||
run: |
|
||||
echo "build=$WORKFLOW_RUN" >> assets/configs/app.properties
|
||||
- name: Grant execute permission for gradlew
|
||||
run: chmod +x gradlew
|
||||
- name: Build JAR dist files
|
||||
|
||||
@@ -1 +1 @@
|
||||
version=0.1.1-SNAPSHOT
|
||||
version=0.1.1-SNAPSHOT
|
||||
|
||||
+1
-1
Submodule hyperlap2d-common-api updated: ade72d1435...f76bbd6753
@@ -8,6 +8,7 @@ import games.rednblack.editor.renderer.utils.Version;
|
||||
import games.rednblack.editor.utils.AppConfig;
|
||||
import games.rednblack.h2d.common.network.HttpDownloadUtility;
|
||||
import games.rednblack.h2d.common.network.model.GithubReleaseData;
|
||||
import games.rednblack.h2d.common.network.model.SnapshotReleaseData;
|
||||
import org.lwjgl.util.tinyfd.TinyFileDialogs;
|
||||
import org.puremvc.java.interfaces.INotification;
|
||||
import org.puremvc.java.patterns.mediator.Mediator;
|
||||
@@ -53,18 +54,29 @@ public class SplashMediator extends Mediator<Object> {
|
||||
executor.execute(() -> {
|
||||
splash.setProgressStatus("Checking for updates...");
|
||||
try {
|
||||
String data = HttpDownloadUtility.downloadToString("https://api.github.com/repos/rednblackgames/HyperLap2D/releases/latest");
|
||||
Json json = new Json();
|
||||
json.setIgnoreUnknownFields(true);
|
||||
GithubReleaseData jsonData = json.fromJson(GithubReleaseData.class, data);
|
||||
Version latestVer = new Version(jsonData.tag_name.replace("v", ""));
|
||||
Version currVer = AppConfig.getInstance().version;
|
||||
Version latestVer, currVer;
|
||||
if (AppConfig.getInstance().build != null) {
|
||||
String data = HttpDownloadUtility.downloadToString("https://hyperlap2d.rednblack.games/upload/snapshots/snapshot.json");
|
||||
Json json = new Json();
|
||||
json.setIgnoreUnknownFields(true);
|
||||
SnapshotReleaseData jsonData = json.fromJson(SnapshotReleaseData.class, data);
|
||||
latestVer = new Version(String.valueOf(jsonData.build));
|
||||
currVer = new Version(AppConfig.getInstance().build);
|
||||
} else {
|
||||
String data = HttpDownloadUtility.downloadToString("https://api.github.com/repos/rednblackgames/HyperLap2D/releases/latest");
|
||||
Json json = new Json();
|
||||
json.setIgnoreUnknownFields(true);
|
||||
GithubReleaseData jsonData = json.fromJson(GithubReleaseData.class, data);
|
||||
latestVer = new Version(jsonData.tag_name.replace("v", ""));
|
||||
currVer = AppConfig.getInstance().version;
|
||||
}
|
||||
|
||||
if (latestVer.compareTo(currVer) > 0) {
|
||||
boolean result = TinyFileDialogs.tinyfd_messageBox("New update found!",
|
||||
"A new version of HyperLap2D has found '" + latestVer.get() + "' (current: '" + currVer.get() + "'), would you like to download it?",
|
||||
"A new version of HyperLap2D has been found " + latestVer.get() + " (current: " + currVer.get() + "), would you like to download it?",
|
||||
"yesno", "info", true);
|
||||
if (result) {
|
||||
Gdx.net.openURI("https://github.com/rednblackgames/HyperLap2D/releases");
|
||||
Gdx.net.openURI("https://hyperlap2d.rednblack.games/download");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -30,6 +30,7 @@ public class AppConfig {
|
||||
|
||||
public String versionString;
|
||||
public Version version;
|
||||
public String build;
|
||||
|
||||
public Properties properties;
|
||||
|
||||
@@ -67,6 +68,7 @@ public class AppConfig {
|
||||
properties.load(propertiesInput);
|
||||
versionString = properties.getProperty("version");
|
||||
version = new Version(versionString.replaceAll("[^0-9\\\\.]", ""));
|
||||
build = properties.getProperty("build");
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ public class AboutDialog extends H2DDialog {
|
||||
leftTable.add(new VisImage(VisUI.getSkin().getDrawable("splash_logo"))).pad(5).row();
|
||||
leftTable.add("HyperLap2D").padLeft(5).padRight(5).row();
|
||||
leftTable.add("Release " + AppConfig.getInstance().versionString).row();
|
||||
if (AppConfig.getInstance().build != null)
|
||||
leftTable.add("Build #" + AppConfig.getInstance().build).row();
|
||||
leftTable.add("Total Time").padTop(20).row();
|
||||
leftTable.add(totalTimeSpent).row();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user