Skip to content
Commits on Source (20)
......@@ -15,7 +15,7 @@ jobs:
fetch-depth: 0
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
......@@ -32,7 +32,7 @@ jobs:
# DEPLOY TO GH-PAGES
- name: Deploy to GitHub-Pages
uses: JamesIves/github-pages-deploy-action@v4.2.2
uses: JamesIves/github-pages-deploy-action@v4.2.5
with:
branch: gh-pages
folder: build/docs/javadoc
......@@ -46,7 +46,7 @@ jobs:
# BUILD PROJECT AND PUBLISH TO PACKAGES
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
......
......@@ -44,7 +44,7 @@ jobs:
# BUILD PROJECT AND PUBLISH TO PACKAGES
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
......@@ -80,7 +80,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/libs/VersionChecker-${{steps.tag.outputs.tag}}
asset_path: ./build/libs/VersionChecker-${{steps.tag.outputs.tag}}.jar
asset_name: VersionChecker-${{steps.tag.outputs.tag}}.jar
asset_content_type: application/jar
......
......@@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '8'
......
......@@ -16,7 +16,7 @@ variables:
SECRET_DETECTION_EXCLUDED_PATHS: ""
services:
- name: griefed/gitlab-ci-cd:2.0.0
- name: griefed/gitlab-ci-cd:2.0.3
alias: docker
sast:
......@@ -70,7 +70,7 @@ secret_detection:
Gradle Test:
stage: Tests
image: griefed/baseimage-ubuntu-jdk-8:2.0.2
image: griefed/baseimage-ubuntu-jdk-8:2.0.6
before_script:
- echo "**** Running in $CI_JOB_ID ****"
- echo "**** Java location ****"
......@@ -105,7 +105,7 @@ Generate Release:
artifacts: false
- job: secret_detection
artifacts: false
image: ghcr.io/griefed/gitlab-ci-cd:2.0.3
image: ghcr.io/griefed/gitlab-ci-cd:2.0.4
script:
- npx semantic-release
rules:
......@@ -115,7 +115,7 @@ Generate Release:
Build Release:
stage: Build Release
image: griefed/baseimage-ubuntu-jdk-8:2.0.2
image: griefed/baseimage-ubuntu-jdk-8:2.0.6
before_script:
- echo "**** Running in $CI_JOB_ID ****"
- echo "**** Java location ****"
......@@ -155,7 +155,7 @@ Build Release:
Publish Maven Artifacts:
stage: Build Release
image: ghcr.io/griefed/baseimage-ubuntu-jdk-8:2.0.6
image: ghcr.io/griefed/baseimage-ubuntu-jdk-8:2.0.7
before_script:
- echo "**** Running in $CI_JOB_ID ****"
- echo "**** Java location ****"
......@@ -175,7 +175,7 @@ Publish Maven Artifacts:
Inform About Release:
stage: Build Release
image: ghcr.io/griefed/gitlab-ci-cd:2.0.3
image: ghcr.io/griefed/gitlab-ci-cd:2.0.4
needs:
- job: Build Release
artifacts: false
......@@ -227,7 +227,7 @@ coverage:
pages:
stage: Documentation
image: griefed/baseimage-ubuntu-jdk-8:2.0.2
image: griefed/baseimage-ubuntu-jdk-8:2.0.6
before_script:
- which java
- chmod +x gradlew
......
### [1.0.8](https://git.griefed.de/Griefed/VersionChecker/compare/1.0.7...1.0.8) (2022-03-23)
### 🦊 CI/CD
* **GitHub:** Fix release asset path ([009c4d2](https://git.griefed.de/Griefed/VersionChecker/commit/009c4d24cbefe9787f300130e0fc935704884465))
### 🛠 Fixes
* When an alpha or beta for the latest release is used, return the latest release as the available update. Example: 1.2.5-alpha.1 -> 1.2.5 and 1.2.5-beta.1 -> 1.2.5 ([45a6296](https://git.griefed.de/Griefed/VersionChecker/commit/45a6296b68d5df3c98cf6e362306543bf3fc3d98))
### Other
* **deps:** update actions/setup-java action to v3 ([47235d4](https://git.griefed.de/Griefed/VersionChecker/commit/47235d483f2a4e61588c9821c907121b29262614))
* **deps:** update dependency ghcr.io/griefed/baseimage-ubuntu-jdk-8 to v2.0.7 ([74de493](https://git.griefed.de/Griefed/VersionChecker/commit/74de49380198a9c4c9c011aaba89730d7c8ac996))
* **deps:** update dependency ghcr.io/griefed/gitlab-ci-cd to v2.0.4 ([4cde6ba](https://git.griefed.de/Griefed/VersionChecker/commit/4cde6ba496d38f460e633e8ef899ebee1137f0be))
* **deps:** update dependency gradle to v7.4 ([97b1ff0](https://git.griefed.de/Griefed/VersionChecker/commit/97b1ff004b4a97e20dec516cfd0586dd24ddb7e8))
* **deps:** update dependency griefed/baseimage-ubuntu-jdk-8 to v2.0.6 ([e8f363b](https://git.griefed.de/Griefed/VersionChecker/commit/e8f363b75fe62baa3825709e98ac5523812fe374))
* **deps:** update dependency griefed/gitlab-ci-cd to v2.0.3 ([94d7d29](https://git.griefed.de/Griefed/VersionChecker/commit/94d7d29b44285073039bc18d27c5aef0ba5341df))
* **deps:** update dependency org.jetbrains:annotations to v23 ([4254cab](https://git.griefed.de/Griefed/VersionChecker/commit/4254cab598455dd1ee8be64ae08a307b13ff9657))
* **deps:** update jamesives/github-pages-deploy-action action to v4.2.5 ([413eeb2](https://git.griefed.de/Griefed/VersionChecker/commit/413eeb2256d6772a0fe44b6218dbc6ab2c620b22))
### [1.0.7](https://git.griefed.de/Griefed/VersionChecker/compare/1.0.6...1.0.7) (2022-02-26)
......
......@@ -42,7 +42,7 @@ dependencies {
implementation 'org.apache.logging.log4j:log4j-core:2.17.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.13.1'
implementation 'org.jetbrains:annotations:22.0.0'
implementation 'org.jetbrains:annotations:23.0.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testImplementation 'org.junit.platform:junit-platform-commons:1.8.2'
......
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
......@@ -102,7 +102,14 @@ public abstract class VersionChecker {
}
if (compareSemantics(currentVersion, latestVersion(checkForPreReleases), Comparison.NEW)) {
return latestVersion(checkForPreReleases);
} else if (currentVersion.matches("\\d+\\.\\d+\\.\\d+-(alpha|beta)\\.\\d+") &&
compareSemantics(currentVersion, latestVersion(false), Comparison.EQUAL)) {
return latestVersion(false);
}
return "up_to_date";
......
......@@ -7,7 +7,6 @@ import org.apache.logging.log4j.Logger;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.sql.Time;
@SuppressWarnings("BusyWait")
public class UpdateCheckerTests {
......@@ -18,11 +17,16 @@ public class UpdateCheckerTests {
private GitLabChecker GITGRIEFED;
private GitLabChecker GITLAB;
//private GitHubChecker tests;
public UpdateCheckerTests() throws IOException {
this.GITHUB = new GitHubChecker("Griefed/ServerPackCreator");
this.GITLAB = new GitLabChecker("https://gitlab.com/api/v4/projects/32677538/releases");
this.GITGRIEFED = new GitLabChecker("https://git.griefed.de/api/v4/projects/63/releases");
//this.tests = new GitHubChecker("Griefed/Action_tests");
//this.tests.refresh();
}
@Test
......@@ -123,131 +127,267 @@ public class UpdateCheckerTests {
String latestPre = GITHUB.latestVersion(true);
System.out.println("Old version should return the newest regular release, whilst not checking for pre-releases.");
Assertions.assertEquals(latest,checkForUpdate(
"2.0.0",
false
Assertions.assertEquals(
latest,
checkForUpdate(
"2.0.0",
false
).split(";")[0]);
System.out.println("Old version should return the newest pre-release release, whilst checking for pre-releases, too.");
Assertions.assertEquals(latestPre,checkForUpdate(
"2.0.0",
true
Assertions.assertEquals(
latestPre,
checkForUpdate(
"2.0.0",
true
).split(";")[0]);
System.out.println("Old alpha should return the newest regular release, whilst not checking for pre-releases.");
Assertions.assertEquals(latest,checkForUpdate(
"2.0.0-alpha.2",
false
Assertions.assertEquals(
latest,
checkForUpdate(
"2.0.0-alpha.2",
false
).split(";")[0]);
System.out.println("Old alpha should return the newest alpha/beta, whilst checking for pre-releases, too.");
Assertions.assertEquals(latestPre,checkForUpdate(
"2.0.0-alpha.2",
true
Assertions.assertEquals(
latestPre,
checkForUpdate(
"2.0.0-alpha.2",
true
).split(";")[0]);
System.out.println("Old beta should return the newest regular release, whilst not checking for pre-releases.");
Assertions.assertEquals(latest,checkForUpdate(
"2.0.0-beta.2",
false
Assertions.assertEquals(
latest,
checkForUpdate(
"2.0.0-beta.2",
false
).split(";")[0]);
System.out.println("Old beta should return the newest alpha/beta, whilst checking for pre-releases, too.");
Assertions.assertEquals(latestPre,checkForUpdate(
"2.0.0-beta.2",
true
Assertions.assertEquals(
latestPre,
checkForUpdate(
"2.0.0-beta.2",
true
).split(";")[0]);
System.out.println("Old beta, but newer than the newest regular release, should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"3.0.0-beta.2",
false
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"3.0.0-beta.2",
false
)
);
System.out.println("Old beta, but newer than the newest regular release, should the latest available alpha/beta, whilst checking for pre-releases, too.");
Assertions.assertEquals(latestPre,checkForUpdate(
"3.0.0-beta.2",
true
Assertions.assertEquals(
latestPre,
checkForUpdate(
"3.0.0-beta.2",
true
).split(";")[0]);
System.out.println("Old beta, but newer than the newest regular release, should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"3.0.0-alpha.2",
false
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"3.0.0-alpha.2",
false
)
);
System.out.println("Old alpha, but newer than the newest regular release, should return the newest alpha/beta, whilst checking for pre-releases, too.");
Assertions.assertEquals(latestPre,checkForUpdate(
"3.0.0-alpha.2",
true
Assertions.assertEquals(
latestPre,
checkForUpdate(
"3.0.0-alpha.2",
true
).split(";")[0]);
System.out.println("Future alpha should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789-alpha.2",
false
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789-alpha.2",
false
)
);
System.out.println("Future alpha should return no available updates, whilst checking for pre-releases, too.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789-alpha.2",
true
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789-alpha.2",
true
)
);
System.out.println("Future beta should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789-beta.2",
false
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789-beta.2",
false
)
);
System.out.println("Future beta should return no available updates, whilst checking for pre-releases, too.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789-beta.2",
true
).split(";")[0]);
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789-beta.2",
true
)
);
System.out.println("Newer version should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789",
false
));
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789",
false
)
);
System.out.println("Newer version should return no available updates, whilst checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
"123.456.789",
true
));
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
"123.456.789",
true
)
);
System.out.println("Latest version should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
latest,
false
)
);
System.out.println("Latest alpha/beta should return no available updates, whilst checking for pre-releases, too.");
Assertions.assertEquals(
"No updates available.",
checkForUpdate(
latestPre,
true
)
);
System.out.println("Beta for latest version should return latest version as available update, whilst not checking for pre-releases.");
Assertions.assertEquals(
latest,
checkForUpdate(
latest + "-beta.2",
false
).split(";")[0]);
System.out.println("Beta for latest version should return latest version as available update.");
Assertions.assertEquals(
latestPre,
checkForUpdate(
latest + "-beta.2",
true
).split(";")[0]);
System.out.println("Newest version should return no available updates, whilst not checking for pre-releases.");
Assertions.assertEquals("No updates available.",checkForUpdate(
System.out.println("Alpha for latest version should return latest version as available update.");
Assertions.assertEquals(
latest,
false
));
checkForUpdate(
latest + "-alpha.12",
false
).split(";")[0]);
System.out.println("Newest alpha/beta should return no available updates, whilst checking for pre-releases, too.");
Assertions.assertEquals("No updates available.",checkForUpdate(
System.out.println("Alpha for latest version should return latest version as available update.");
Assertions.assertEquals(
latestPre,
true));
checkForUpdate(
latest + "-alpha.2",
true
).split(";")[0]);
/*System.out.println(tests.latestVersion(false));
System.out.println("Beta for latest version should return latest version as available update, whilst not checking for pre-releases.");
Assertions.assertEquals(
"1.2.5",
testChecker(
"1.2.5-beta.1",
false
).split(";")[0]);
System.out.println("Beta for latest version should return latest version as available update.");
Assertions.assertEquals(
"1.2.5",
testChecker(
"1.2.5-beta.1",
true
).split(";")[0]);
System.out.println("Alpha for latest version should return latest version as available update.");
Assertions.assertEquals(
"1.2.5",
testChecker(
"1.2.5-alpha.1",
false
).split(";")[0]);
System.out.println("Alpha for latest version should return latest version as available update.");
Assertions.assertEquals(
"1.2.5",
testChecker(
"1.2.5-alpha.1",
true
).split(";")[0]);*/
}
public String checkForUpdate(String version, boolean pre) {
/*private String testChecker(String version, boolean pre) {
String updater = null;
// Check GitHub for the most recent release.
if (tests != null) {
// Check GitHub for new versions which are not pre-releases. Run with true to check pre-releases as well.
updater = tests.checkForUpdate(version, pre);
}
System.out.println("Check pre: " + pre );
System.out.println("Checked version: " + version);
System.out.println("Result: " + updater);
System.out.println();
return updater;
}*/
private String checkForUpdate(String version, boolean pre) {
String updater = null;
......