Skip to content

Commit

Permalink
Added support for the prerelease attribute in app.xml which will allo…
Browse files Browse the repository at this point in the history
…w the app to look for prerelease versions for updating. Also added environment variable JDEPLOY_BUNDLE_PRERELEASE that can override this setting when running jdeploy package.

Updated the release.sh script to use thie environment variable when not building a release version.
  • Loading branch information
shannah committed Jan 14, 2022
1 parent 433525e commit 48a7adb
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 6 deletions.
7 changes: 6 additions & 1 deletion cli/src/main/java/ca/weblite/jdeploy/JDeploy.java
Original file line number Diff line number Diff line change
Expand Up @@ -1024,14 +1024,19 @@ static boolean isWindows() {

static String npm = isWindows() ? "npm.cmd" : "npm";


private static String getenv(String key, String defaultValue) {
String value = System.getenv(key);
if (value == null) return defaultValue;
return value;
}

private void loadAppInfo(AppInfo appInfo) throws IOException {

appInfo.setNpmPackage((String)m().get("name"));
appInfo.setNpmVersion(getString("version", "latest"));
appInfo.setMacAppBundleId(getString("macAppBundleId", null));
appInfo.setTitle(getString("displayName", appInfo.getNpmPackage()));
appInfo.setNpmAllowPrerelease("true".equals(getenv("JDEPLOY_BUNDLE_PRERELEASE", getString("prerelease", "false"))));
if (rj().getAsBoolean("codesign") && rj().getAsBoolean("notarize")) {
appInfo.setCodeSignSettings(AppInfo.CodeSignSettings.CodeSignAndNotarize);
} else if (rj().getAsBoolean("codesign")) {
Expand Down
8 changes: 8 additions & 0 deletions installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@

A desktop installer for GUI apps deployed using [jDeploy](https://github.com/shannah/jdeploy)

# Release Instructions

NPM releases are automated in Github actions. By creating a tag in Github, it will automatically make the corresponding release on NPM.

Version naming convension: X.Y.Z-alpha.N

E.g. 3.0.0-alpha.1 for pre-release. or 3.0.0 for stable release.

10 changes: 9 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ mvn clean package
#Next build the installer because we need to sign it and bundle it
cd ../installer
mvn clean package
java -jar "$JDEPLOY" clean package
if [ "$GITHUB_REF_TYPE" != "tag" ] || ! [[ "$GITHUB_REF_NAME" =~ "-alpha" ]]; then
# IF this is not a tag, or it is a tagged prerelease, then we'll mark the installer as
# a prerelease installer so that it gets the latest installer - even prerelease.
JDEPLOY_BUNDLE_PRERELEASE=true java -jar "$JDEPLOY" clean package
else
# Otherwise, we just build normally - in which case the installer will only use the latest
# stable version.
java -jar "$JDEPLOY" clean package
fi

# Make sure the codesign was successful
codesign -vvvv jdeploy/bundles/mac/jdeploy-installer.app
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class AppDescription {
private String iconDataURI;
private String npmPackage;
private String npmVersion;
private boolean npmPrerelease;
private String url;
private List<Jar> jars;
private String name;
Expand Down Expand Up @@ -218,4 +219,12 @@ public String getIconDataURI() {
public void setIconDataURI(String iconDataURI) {
this.iconDataURI = iconDataURI;
}

public boolean isNpmPrerelease() {
return npmPrerelease;
}

public void setNpmPrerelease(boolean npmPrerelease) {
this.npmPrerelease = npmPrerelease;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public static BundlerResult runit(AppInfo appInfo, String url,


AppDescription app = new AppDescription();

app.setNpmPrerelease(appInfo.isNpmAllowPrerelease());
app.setName(appInfo.getTitle());
URL iconURL = URLUtil.url(appInfo.getAppURL(), "icon.png");
app.setIconDataURI(toDataURI(iconURL));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ private static void processAppXml(AppDescription app, File dest) throws Exceptio

if (app.getNpmPackage() != null && app.getNpmVersion() != null) {

out.start("app", "name", app.getName(), "package", app.getNpmPackage(), "version", app.getNpmVersion(), "icon", app.getIconDataURI()).end();
out.start("app",
"name", app.getName(),
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease()+""
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,13 @@ private static void processAppXml(AppDescription app, File contentsDir) throws E
}
if (app.getNpmPackage() != null && app.getNpmVersion() != null) {

out.start("app", "name", app.getName(), "package", app.getNpmPackage(), "version", app.getNpmVersion(), "icon", app.getIconDataURI()).end();
out.start("app",
"name", app.getName(),
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease() ? "true" : "false"
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ private static void processAppXml(AppDescription app, File dest) throws Exceptio
out.header();
if (app.getNpmPackage() != null && app.getNpmVersion() != null) {

out.start("app", "name", app.getName(), "package", app.getNpmPackage(), "version", app.getNpmVersion(), "icon", app.getIconDataURI()).end();
out.start("app",
"name", app.getName(),
"package", app.getNpmPackage(),
"version", app.getNpmVersion(),
"icon", app.getIconDataURI(),
"prerelease", app.isNpmPrerelease()+""
).end();
} else {
out.start("app", "name", app.getName(), "url", app.getUrl(), "icon", app.getIconDataURI()).end();
}
Expand Down

0 comments on commit 48a7adb

Please sign in to comment.