fix: Actions

Reusable workflows my ass
This commit is contained in:
Ampflower 🌺 2025-03-12 23:43:30 -07:00
parent dfd5b7ad55
commit 9a8ab18fa2
No known key found for this signature in database
GPG Key ID: FC0397C90D508D7F
5 changed files with 14 additions and 7 deletions

View File

@ -10,7 +10,7 @@ permissions:
jobs: jobs:
build: build:
uses: Modflower/workflows/.github/workflows/mod-publish.yml@main uses: Pridecraft-Studios/workflows/.github/workflows/mod-publish.yml@main
with: with:
artifacts: | artifacts: |
*/build/libs/* */build/libs/*

View File

@ -40,7 +40,7 @@ public class BuildPlugin implements Plugin<Project> {
version, version,
Util.mkVersion(version + "+mc." + minecraftVersion), Util.mkVersion(version + "+mc." + minecraftVersion),
Util.getVersionType(version), Util.getVersionType(version),
Util.mkChangelog(Properties.str(target, "github")), Util.mkChangelog(Properties.str(target, "github"), Properties.str(target, "forge")),
Util.getCompatibleVersions(libs, target) Util.getCompatibleVersions(libs, target)
)); ));

View File

@ -22,7 +22,7 @@ public final class Properties {
} }
public static @Nullable String str(Project project, String property) { public static @Nullable String str(Project project, String property) {
final var p = project.property(property); final var p = project.findProperty(property);
if (p == null) { if (p == null) {
return null; return null;
} }

View File

@ -24,7 +24,7 @@ public class Util {
return URLEncoder.encode(str, StandardCharsets.UTF_8); return URLEncoder.encode(str, StandardCharsets.UTF_8);
} }
public static String mkChangelog(String git) { public static String mkChangelog(String git, String forge) {
if (!isBlank(Env.Changelog)) { if (!isBlank(Env.Changelog)) {
logger.debug("Changelog found, returning {}", Env.Changelog); logger.debug("Changelog found, returning {}", Env.Changelog);
return Env.Changelog; return Env.Changelog;
@ -35,8 +35,10 @@ public class Util {
return null; return null;
} }
if (startsWith(Env.Reference, "refs/tags/")) { final var host = VcsHost.find(git, forge);
final var host = VcsHost.find(git); if (host == null) {
logger.warn("Forge not found. Returning bare link to {}", git);
} else if (startsWith(Env.Reference, "refs/tags/")) {
logger.warn("Changelog not found but tag reference was, returning link to {}{}{}", logger.warn("Changelog not found but tag reference was, returning link to {}{}{}",
git, host.release, urlEncode(Env.getTag())); git, host.release, urlEncode(Env.getTag()));

View File

@ -17,7 +17,7 @@ public enum VcsHost {
this.release = release; this.release = release;
} }
public static VcsHost find(String url) { public static VcsHost find(String url, String forge) {
// "https://".length = 8 // "https://".length = 8
final int lastSlash = url.indexOf('/', 8); final int lastSlash = url.indexOf('/', 8);
for (final var host : values()) { for (final var host : values()) {
@ -28,6 +28,11 @@ public enum VcsHost {
return host; return host;
} }
} }
for (final var host : values()) {
if (host.name().equals(forge)) {
return host;
}
}
return null; return null;
} }
} }