mirror of
https://github.com/sirjonasxx/G-Earth.git
synced 2024-11-23 17:00:52 +01:00
Update ci and versioning
This commit is contained in:
parent
8d495347ba
commit
d951f1cbad
43
.github/workflows/build.yml
vendored
43
.github/workflows/build.yml
vendored
@ -17,17 +17,17 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout G-Earth
|
- name: Checkout G-Earth
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Checkout G-Wasm
|
- name: Checkout G-Wasm
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
repository: sirjonasxx/G-Wasm
|
repository: sirjonasxx/G-Wasm
|
||||||
path: gwasm
|
path: gwasm
|
||||||
ref: minimal
|
ref: minimal
|
||||||
|
|
||||||
- name: Set up JDK 8
|
- name: Set up JDK 8
|
||||||
uses: actions/setup-java@v2
|
uses: actions/setup-java@v4
|
||||||
with:
|
with:
|
||||||
java-version: '8'
|
java-version: '8'
|
||||||
java-package: jdk+fx
|
java-package: jdk+fx
|
||||||
@ -38,52 +38,33 @@ jobs:
|
|||||||
run: mvn -B install
|
run: mvn -B install
|
||||||
|
|
||||||
- name: Build G-Earth
|
- name: Build G-Earth
|
||||||
run: mvn -B package
|
|
||||||
|
|
||||||
- name: Zip Build/Mac
|
|
||||||
run: |
|
run: |
|
||||||
cd ${{ github.workspace }}/Build/Mac/
|
mvn -B package -Drepository=${GITHUB_REPOSITORY}
|
||||||
zip -r ../../build-mac.zip *
|
|
||||||
|
|
||||||
- name: Zip Build/Linux
|
|
||||||
run: |
|
|
||||||
cd ${{ github.workspace }}/Build/Linux/
|
|
||||||
zip -r ../../build-linux.zip *
|
|
||||||
|
|
||||||
- name: Zip Build/Windows_32bit
|
|
||||||
run: |
|
|
||||||
cd ${{ github.workspace }}/Build/Windows_32bit/
|
|
||||||
zip -r ../../build-win32.zip *
|
|
||||||
|
|
||||||
- name: Zip Build/Windows_64bit
|
|
||||||
run: |
|
|
||||||
cd ${{ github.workspace }}/Build/Windows_64bit/
|
|
||||||
zip -r ../../build-win64.zip *
|
|
||||||
|
|
||||||
- name: Upload Mac OSX
|
- name: Upload Mac OSX
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Mac OSX
|
name: Mac OSX
|
||||||
path: build-mac.zip
|
path: Build/Mac/*
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Upload Linux
|
- name: Upload Linux
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Linux
|
name: Linux
|
||||||
path: build-linux.zip
|
path: Build/Linux/*
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Upload Windows x32
|
- name: Upload Windows x32
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Windows x32
|
name: Windows x32
|
||||||
path: build-win32.zip
|
path: Build/Windows_32bit/*
|
||||||
retention-days: 7
|
retention-days: 7
|
||||||
|
|
||||||
- name: Upload Windows x64
|
- name: Upload Windows x64
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Windows x64
|
name: Windows x64
|
||||||
path: build-win64.zip
|
path: Build/Windows_64bit/*
|
||||||
retention-days: 7
|
retention-days: 7
|
@ -17,11 +17,27 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>G-Earth</groupId>
|
<groupId>G-Earth</groupId>
|
||||||
<artifactId>G-Earth-Parent</artifactId>
|
<artifactId>G-Earth-Parent</artifactId>
|
||||||
<version>1.5.3</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>G-Earth</finalName>
|
<finalName>G-Earth</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/main/resources</directory>
|
||||||
|
<filtering>true</filtering>
|
||||||
|
<includes>
|
||||||
|
<include>**/build.properties</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
<resource>
|
||||||
|
<directory>${basedir}/src/main/resources</directory>
|
||||||
|
<filtering>false</filtering>
|
||||||
|
<excludes>
|
||||||
|
<exclude>**/build.properties</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
|
@ -19,12 +19,18 @@ import javafx.scene.control.Alert;
|
|||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import javafx.stage.StageStyle;
|
import javafx.stage.StageStyle;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
public class GEarth extends Application {
|
public class GEarth extends Application {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(GEarth.class);
|
||||||
|
|
||||||
public static GEarth main;
|
public static GEarth main;
|
||||||
public static String version = "1.5.3";
|
public static String version;
|
||||||
public static String gitApi = "https://api.github.com/repos/sirjonasxx/G-Earth/releases/latest";
|
public static String repository;
|
||||||
public static ObservableObject<Theme> observableTheme;
|
public static ObservableObject<Theme> observableTheme;
|
||||||
|
|
||||||
private Stage stage;
|
private Stage stage;
|
||||||
@ -36,6 +42,19 @@ public class GEarth extends Application {
|
|||||||
ThemeFactory.themeForTitle(Cacher.getCacheContents().getString("theme")) :
|
ThemeFactory.themeForTitle(Cacher.getCacheContents().getString("theme")) :
|
||||||
ThemeFactory.getDefaultTheme()
|
ThemeFactory.getDefaultTheme()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Load build.properties
|
||||||
|
try {
|
||||||
|
final Properties buildProperties = new Properties();
|
||||||
|
buildProperties.load(GEarth.class.getResourceAsStream("/build.properties"));
|
||||||
|
|
||||||
|
version = buildProperties.getProperty("build.version");
|
||||||
|
repository = buildProperties.getProperty("build.github");
|
||||||
|
|
||||||
|
logger.info("Starting G-Earth {} from repository {}", version, repository);
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -8,32 +8,35 @@ import javafx.scene.control.Alert;
|
|||||||
import javafx.scene.control.ButtonType;
|
import javafx.scene.control.ButtonType;
|
||||||
import javafx.scene.control.Hyperlink;
|
import javafx.scene.control.Hyperlink;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.image.Image;
|
|
||||||
import javafx.scene.layout.FlowPane;
|
import javafx.scene.layout.FlowPane;
|
||||||
import javafx.scene.layout.Region;
|
import javafx.scene.layout.Region;
|
||||||
import javafx.scene.web.WebView;
|
import javafx.scene.web.WebView;
|
||||||
import javafx.stage.Stage;
|
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
import org.apache.maven.artifact.versioning.ComparableVersion;
|
import org.apache.maven.artifact.versioning.ComparableVersion;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
|
|
||||||
import static gearth.GEarth.gitApi;
|
|
||||||
import static gearth.GEarth.version;
|
|
||||||
|
|
||||||
public class UpdateChecker {
|
public class UpdateChecker {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(UpdateChecker.class);
|
||||||
|
|
||||||
public static void checkForUpdates() {
|
public static void checkForUpdates() {
|
||||||
|
final String currentVersion = GEarth.version;
|
||||||
|
final String latestReleaseApi = String.format("https://api.github.com/repos/%s/releases/latest", GEarth.repository);
|
||||||
|
final String latestRelease = String.format("https://github.com/%s/releases/latest", GEarth.repository);
|
||||||
|
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
JSONObject object = new JSONObject(IOUtils.toString(
|
JSONObject object = new JSONObject(IOUtils.toString(
|
||||||
new URL(gitApi).openStream(), StandardCharsets.UTF_8));
|
new URL(latestReleaseApi).openStream(), StandardCharsets.UTF_8));
|
||||||
|
|
||||||
String gitv = (String)object.get("tag_name");
|
String gitv = (String)object.get("tag_name");
|
||||||
if (new ComparableVersion(version).compareTo(new ComparableVersion(gitv)) < 0) {
|
if (new ComparableVersion(currentVersion).compareTo(new ComparableVersion(gitv)) < 0) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
String body = (String)object.get("body");
|
String body = (String)object.get("body");
|
||||||
boolean isForcedUpdate = body.contains("(!)");
|
boolean isForcedUpdate = body.contains("(!)");
|
||||||
@ -42,7 +45,7 @@ public class UpdateChecker {
|
|||||||
|
|
||||||
FlowPane fp = new FlowPane();
|
FlowPane fp = new FlowPane();
|
||||||
Label lbl = new Label(LanguageBundle.get("alert.outdated.content.newversion") + " ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + LanguageBundle.get("alert.outdated.content.update") + ":");
|
Label lbl = new Label(LanguageBundle.get("alert.outdated.content.newversion") + " ("+gitv+")" + System.lineSeparator()+ System.lineSeparator() + LanguageBundle.get("alert.outdated.content.update") + ":");
|
||||||
Hyperlink link = new Hyperlink("https://github.com/sirjonasxx/G-Earth/releases");
|
Hyperlink link = new Hyperlink(latestRelease);
|
||||||
fp.getChildren().addAll( lbl, link);
|
fp.getChildren().addAll( lbl, link);
|
||||||
link.setOnAction(event -> {
|
link.setOnAction(event -> {
|
||||||
GEarth.main.getHostServices().showDocument(link.getText());
|
GEarth.main.getHostServices().showDocument(link.getText());
|
||||||
@ -52,7 +55,12 @@ public class UpdateChecker {
|
|||||||
|
|
||||||
|
|
||||||
WebView webView = new WebView();
|
WebView webView = new WebView();
|
||||||
webView.getEngine().loadContent(String.format("<html>%s (%s)<br><br>%s:<br><a href=\"https://github.com/sirjonasxx/G-Earth/releases\">https://github.com/sirjonasxx/G-Earth/releases</a></html>", LanguageBundle.get("alert.outdated.content.newversion"), gitv, LanguageBundle.get("alert.outdated.content.update")));
|
webView.getEngine().loadContent(String.format("<html>%s (%s)<br><br>%s:<br><a href=\"%s\">%s</a></html>",
|
||||||
|
LanguageBundle.get("alert.outdated.content.newversion"),
|
||||||
|
gitv,
|
||||||
|
LanguageBundle.get("alert.outdated.content.update"),
|
||||||
|
latestRelease,
|
||||||
|
latestRelease));
|
||||||
webView.setPrefSize(500, 200);
|
webView.setPrefSize(500, 200);
|
||||||
|
|
||||||
alert.setResizable(false);
|
alert.setResizable(false);
|
||||||
@ -71,7 +79,7 @@ public class UpdateChecker {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
// e.printStackTrace();
|
logger.error("Failed to check for updates", e);
|
||||||
}
|
}
|
||||||
}).start();
|
}).start();
|
||||||
}
|
}
|
||||||
|
2
G-Earth/src/main/resources/build.properties
Normal file
2
G-Earth/src/main/resources/build.properties
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
build.version=${project.version}
|
||||||
|
build.github=${project.repository}
|
32
pom.xml
32
pom.xml
@ -7,7 +7,12 @@
|
|||||||
<groupId>G-Earth</groupId>
|
<groupId>G-Earth</groupId>
|
||||||
<artifactId>G-Earth-Parent</artifactId>
|
<artifactId>G-Earth-Parent</artifactId>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<version>1.5.3</version>
|
<version>${revision}</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<revision>1.5.4-beta-1</revision>
|
||||||
|
<repository>sirjonasxx/G-Earth</repository>
|
||||||
|
</properties>
|
||||||
|
|
||||||
<name>G-Earth-Parent</name>
|
<name>G-Earth-Parent</name>
|
||||||
<url>https://github.com/sirjonasxx/G-Earth</url>
|
<url>https://github.com/sirjonasxx/G-Earth</url>
|
||||||
@ -20,6 +25,31 @@
|
|||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>flatten-maven-plugin</artifactId>
|
||||||
|
<version>1.1.0</version>
|
||||||
|
<configuration>
|
||||||
|
<updatePomFile>true</updatePomFile>
|
||||||
|
<flattenMode>resolveCiFriendliesOnly</flattenMode>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>flatten</id>
|
||||||
|
<phase>process-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>flatten</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>flatten.clean</id>
|
||||||
|
<phase>clean</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>clean</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
Loading…
Reference in New Issue
Block a user