diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 29c9500..764ac85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,8 +65,8 @@ jobs: branch="${GITHUB_HEAD_REF:-$GITHUB_REF_NAME}" timestamp="$(date -u +'%Y-%m-%dT%H:%M:%SZ')" build_id="${GITHUB_RUN_NUMBER}.${GITHUB_RUN_ATTEMPT}" - artifact_name="HeadDB-ci-${build_id}-${short_sha}" - jar_name="HeadDB-${version}-ci-build-${build_id}-${short_sha}.jar" + artifact_name="HeadDB-${version}+ci.${build_id}.${short_sha}" + jar_name="${artifact_name}.jar" echo "version=${version}" >> "$GITHUB_OUTPUT" echo "short_sha=${short_sha}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0bb6466..6af4e18 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,8 +36,8 @@ concurrency: cancel-in-progress: false jobs: - release_please: - name: Prepare or create release + prepare_release_pr: + name: Prepare release PR if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} runs-on: ubuntu-latest timeout-minutes: 15 @@ -47,7 +47,7 @@ jobs: pull-requests: write steps: - - name: Run Release Please + - name: Prepare release PR uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 with: token: ${{ secrets.RELEASE_PLEASE_TOKEN || github.token }} diff --git a/headdb-platforms/headdb-paper/src/main/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfo.java b/headdb-platforms/headdb-paper/src/main/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfo.java index c4df166..7a81e24 100644 --- a/headdb-platforms/headdb-paper/src/main/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfo.java +++ b/headdb-platforms/headdb-paper/src/main/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfo.java @@ -28,7 +28,7 @@ public record BuildInfo(@NotNull String version, @NotNull String channel, @Nulla Objects.requireNonNull(buildProperties, "buildProperties"); Objects.requireNonNull(gitProperties, "gitProperties"); - String channel = channel(buildProperties.getProperty("headdb.build.channel")); + String channel = channelLabel(buildProperties.getProperty("headdb.build.channel")); String buildNumber = optionalValue(buildProperties.getProperty("headdb.build.number")); String buildAttempt = buildNumber == null ? null : optionalValue(buildProperties.getProperty("headdb.build.attempt")); String runId = buildNumber == null ? null : optionalValue(buildProperties.getProperty("headdb.build.run-id")); @@ -41,17 +41,15 @@ public record BuildInfo(@NotNull String version, @NotNull String channel, @Nulla } public @NotNull String displayBuild() { - String label = channelLabel(); - if (buildNumber == null) { - return label; + return channel; } if (buildAttempt == null || buildAttempt.equals("1")) { - return label + " #" + buildNumber; + return buildNumber; } - return label + " #" + buildNumber + "." + buildAttempt; + return buildNumber + "." + buildAttempt; } public boolean hasGitInfo() { @@ -62,18 +60,6 @@ public boolean hasCiBuildInfo() { return channel.equalsIgnoreCase("ci") && buildNumber != null; } - private @NotNull String channelLabel() { - if (channel.equalsIgnoreCase("ci")) { - return "CI"; - } - - if (channel.length() == 1) { - return channel.toUpperCase(Locale.ROOT); - } - - return Character.toUpperCase(channel.charAt(0)) + channel.substring(1).toLowerCase(Locale.ROOT); - } - private static @NotNull Properties readProperties(@NotNull JavaPlugin plugin, @NotNull String resource) { Properties properties = new Properties(); @@ -90,13 +76,22 @@ public boolean hasCiBuildInfo() { return properties; } - private static @NotNull String channel(@Nullable String value) { + private static @NotNull String channelLabel(@Nullable String value) { String normalized = optionalValue(value); if (normalized == null) { - return "local"; + return "Local"; + } + + if (normalized.equalsIgnoreCase("ci")) { + return "CI"; + } + + if (normalized.length() == 1) { + return normalized.toUpperCase(Locale.ROOT); } - return normalized.toLowerCase(Locale.ROOT); + return Character.toUpperCase(normalized.charAt(0)) + + normalized.substring(1).toLowerCase(Locale.ROOT); } private static @Nullable String firstPresent(@Nullable String first, @Nullable String second) { diff --git a/headdb-platforms/headdb-paper/src/test/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfoTest.java b/headdb-platforms/headdb-paper/src/test/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfoTest.java index 2534899..5378513 100644 --- a/headdb-platforms/headdb-paper/src/test/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfoTest.java +++ b/headdb-platforms/headdb-paper/src/test/java/io/github/silentdevelopment/headdb/paper/runtime/BuildInfoTest.java @@ -29,11 +29,11 @@ void readsCiMetadataWithoutChangingPluginVersion() { BuildInfo buildInfo = BuildInfo.from("7.0.0-rc.7", buildProperties, gitProperties); assertEquals("7.0.0-rc.7", buildInfo.version()); - assertEquals("ci", buildInfo.channel()); + assertEquals("CI", buildInfo.channel()); assertEquals("412", buildInfo.buildNumber()); assertEquals("2", buildInfo.buildAttempt()); assertEquals("22018457391", buildInfo.runId()); - assertEquals("CI #412.2", buildInfo.displayBuild()); + assertEquals("412.2", buildInfo.displayBuild()); assertEquals("45733cd", buildInfo.commit()); assertEquals("45733cd4e64b227ade4f42c30f6b4bdd27e5d88d", buildInfo.fullCommit()); assertEquals("master", buildInfo.branch()); @@ -56,7 +56,7 @@ void usesSafeLocalDefaults() { BuildInfo buildInfo = BuildInfo.from("7.0.0-rc.7", buildProperties, new Properties()); assertEquals("7.0.0-rc.7", buildInfo.version()); - assertEquals("local", buildInfo.channel()); + assertEquals("Local", buildInfo.channel()); assertEquals("Local", buildInfo.displayBuild()); assertNull(buildInfo.buildNumber()); assertNull(buildInfo.buildAttempt());