diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d965901..1468104 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -105,34 +105,20 @@ jobs: fi - name: Build (package) - run: mvn -B -s $GITHUB_WORKSPACE/settings.xml package + run: mvn -B -s $GITHUB_WORKSPACE/settings.xml -DskipTests -Pwith-shade package - name: Deploy Release to GitHub Packages env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: mvn -B -s $GITHUB_WORKSPACE/settings.xml -DskipTests deploy - - name: Verify built artifacts - run: | - set -e - echo "Contents of target/:" - ls -1 target - # Capture a primary jar (non sources/javadoc) for convenience - MAIN_JAR=$(ls target/*.jar | grep -v '\-sources\.jar$' | grep -v '\-javadoc\.jar$' | head -n1 || true) - if [[ -z "$MAIN_JAR" ]]; then - echo "ERROR: No main artifact jar found." - exit 1 - fi - cp "$MAIN_JAR" main-artifact.jar - echo "Selected main artifact: $MAIN_JAR" - - name: Create & Push Git Tag run: | set -e TAG="${{ steps.version.outputs.version }}" if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then - echo "Tag ${TAG} already exists unexpectedly (race condition?)." - exit 1 + echo "Tag ${TAG} already exists unexpectedly (race condition?)." + exit 1 fi git config user.name "github-actions[bot]" git config user.email "41898282+github-actions[bot]@users.noreply.github.com" @@ -146,9 +132,7 @@ jobs: name: "SingularityLib ${{ steps.version.outputs.version }}" generate_release_notes: true files: | - target/*-sources.jar - target/*-javadoc.jar - main-artifact.jar + `target/*.jar` - name: Summary run: | diff --git a/pom.xml b/pom.xml index c124c83..0eb38f4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.github.pinont singularitylib - 1.3.3-SNAPSHOT + 1.3.3 jar SingularityLib @@ -38,6 +38,50 @@ + + + with-shade + + + + shade + + + + + + + org.apache.maven.plugins + maven-shade-plugin + 3.5.3 + + + true + shaded + false + + + org.reflections:reflections + + org/reflections/** + + + + + + + package + + shade + + + + + + + + + https://github.com/Pinont/SingularityLib scm:git:https://github.com/Pinont/SingularityLib.git @@ -131,31 +175,6 @@ - - - org.apache.maven.plugins - maven-shade-plugin - 3.5.3 - - - - org.reflections:reflections - - org/reflections/** - - - - - - - package - - shade - - - - - org.apache.maven.plugins diff --git a/src/main/java/com/github/pinont/singularitylib/api/utils/Common.java b/src/main/java/com/github/pinont/singularitylib/api/utils/Common.java index dff5356..de3a047 100644 --- a/src/main/java/com/github/pinont/singularitylib/api/utils/Common.java +++ b/src/main/java/com/github/pinont/singularitylib/api/utils/Common.java @@ -1,6 +1,8 @@ package com.github.pinont.singularitylib.api.utils; import com.github.pinont.singularitylib.api.enums.PlayerInventorySlotType; +import com.github.pinont.singularitylib.api.manager.ConfigManager; +import com.github.pinont.singularitylib.plugin.CorePlugin; import net.kyori.adventure.text.Component; import net.kyori.adventure.text.minimessage.MiniMessage; import org.bukkit.Bukkit; @@ -28,6 +30,17 @@ public class Common { public Common() { } + /** + * Gets the current API version. + * + * @return the API version string + */ + public static String getAPIVersion() { + ConfigManager apiConfig = new ConfigManager(CorePlugin.getInstance(), "api-version.yml"); + String version = apiConfig.getConfig().getString("api-version", "1.0.0"); + return "V-" + version; + } + /** * Colorizes a string message using MiniMessage format. * diff --git a/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java b/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java index 0704907..abb2860 100644 --- a/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java +++ b/src/main/java/com/github/pinont/singularitylib/plugin/CorePlugin.java @@ -1,5 +1,6 @@ package com.github.pinont.singularitylib.plugin; +import com.github.pinont.singularitylib.api.utils.Common; import com.github.pinont.singularitylib.plugin.listener.PlayerListener; import com.github.pinont.singularitylib.api.command.SimpleCommand; import com.github.pinont.singularitylib.api.manager.ConfigManager; @@ -93,16 +94,6 @@ public static void sendConsoleMessage(String message) { private final List listeners = new ArrayList<>(); - /** - * Gets the current API version. - * - * @return the API version string - */ - public static String getAPIVersion() { - String version = "1.3.0"; - return "V-" + version; - } - private ConfigManager pluginConfig; /** @@ -174,7 +165,7 @@ public final void onEnable() { } // Initialize API To Plugin. - sendConsoleMessage(ChatColor.WHITE + "" + ChatColor.ITALIC + "Hooked " + ChatColor.YELLOW + ChatColor.ITALIC + this.getName() + ChatColor.WHITE + ChatColor.ITALIC + " into " + ChatColor.LIGHT_PURPLE + ChatColor.ITALIC + "SingularityAPI! " + getAPIVersion()); + sendConsoleMessage(ChatColor.WHITE + "" + ChatColor.ITALIC + "Hooked " + ChatColor.YELLOW + ChatColor.ITALIC + this.getName() + ChatColor.WHITE + ChatColor.ITALIC + " into " + ChatColor.LIGHT_PURPLE + ChatColor.ITALIC + "SingularityAPI! " + Common.getAPIVersion()); onPluginStart(); registerAPIListener(this, new PlayerListener()); // new CommandManager().register(this, this.simpleCommands); diff --git a/src/main/resources/api-version.yml b/src/main/resources/api-version.yml new file mode 100644 index 0000000..ab2f7e7 --- /dev/null +++ b/src/main/resources/api-version.yml @@ -0,0 +1 @@ +api-version: ${version} \ No newline at end of file