From 063cae467b11ae1b7352d913d0eed304c7e13d9f Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:34:17 -0500 Subject: [PATCH 1/3] Build and release sources jar --- .github/workflows/buildrelease.yml | 1 + build.gradle | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml index f9ff4c9cd1..79f15d174f 100644 --- a/.github/workflows/buildrelease.yml +++ b/.github/workflows/buildrelease.yml @@ -73,6 +73,7 @@ jobs: - name: Publish using mod-publish-plugin run: ./gradlew build publishMods env: + BUILD_SOURCES_JAR: true CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} CHANGELOG_HIGHLIGHT: ${{ steps.read_changelog.outputs.changelog_highlight }} REF_NAME: ${{ github.ref_name }} diff --git a/build.gradle b/build.gradle index 1a8dccf996..c39e634d48 100644 --- a/build.gradle +++ b/build.gradle @@ -197,7 +197,7 @@ dependencies { // Legacy Item DFU include implementation("net.azureaaron:legacy-item-dfu:${project.legacy_item_dfu_version}") - // JGit used pull data from the NEU item repo + // JGit used to pull data from the NEU item repo include implementation("org.eclipse.jgit:org.eclipse.jgit:${project.jgit_version}") // Apache Commons Math @@ -244,6 +244,10 @@ tasks.withType(JavaCompile).configureEach { } java { + if (System.getenv("BUILD_SOURCES_JAR")?.toBoolean()) { + withSourcesJar() + } + sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 } @@ -296,14 +300,14 @@ spotless { /^( "skyblocker(?:\.([^."]++)(?:\.[^"]++)?)?": "(?:[^\\"]++|\\.)*+",)$\n^(?= "skyblocker\.(?!\2[."]))/, '$1\n\n' replaceRegex \ - "Separate different thrid stems if the first two stems are skyblocker.config", + "Separate different third stems if the first two stems are skyblocker.config", // The third and remaining stems are optional, allowing matching lines with only two stems (in this case "skyblocker.config"), and separating it from other keys that start with "skyblocker.config.[whatever]". /^( "skyblocker\.config(?:\.([^."]++)(?:\.[^"]++)?)?": "(?:[^\\"]++|\\.)*+",)$\n^(?= "skyblocker\.config\.(?!\2[."]))/, '$1\n\n' final List excludeCategories = ["debug", "eventNotifications", "quickNav", "shortcutToKeybindsSettings", "title"] final String excludeCategoriesLookahead = /(?!(?:${excludeCategories.join('|')})(?=[."]))/ replaceRegex \ - "Separate different fouth stems if the first three stems are skyblocker.config.[configCategory]", + "Separate different fourth stems if the first three stems are skyblocker.config.[configCategory]", // A negative lookahead is used before the third stem to exclude the above list of third stems. // The fourth and remaining stems are optional, allowing matching lines with only three stems (such as "skyblocker.config.[configCategory]"), and separating them from other keys that start with "skyblocker.config.[configCategory].[whatever]". // This treats keys with only three stems as if they have an empty fourth stem, which is considered different from any other fourth stem, therefore inserting a newline after them. @@ -345,6 +349,9 @@ def truncateChangelog = { String text, int limit -> publishMods { file = remapJar.archiveFile + if (System.getenv("BUILD_SOURCES_JAR")?.toBoolean()) { + additionalFiles.from(remapSourcesJar.archiveFile) + } changelog = System.getenv('CHANGELOG_HIGHLIGHT') version = "v${project.version}" displayName = "Skyblocker ${mod_version} for ${minecraft_version}" From f88b78b3b163de04dd2ae2ecfbcd93721478abe7 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:42:37 -0500 Subject: [PATCH 2/3] Publish to github packages --- .github/workflows/buildrelease.yml | 2 +- build.gradle | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml index 79f15d174f..8b5a355ee0 100644 --- a/.github/workflows/buildrelease.yml +++ b/.github/workflows/buildrelease.yml @@ -71,7 +71,7 @@ jobs: } >> $GITHUB_OUTPUT - name: Publish using mod-publish-plugin - run: ./gradlew build publishMods + run: ./gradlew build publishMods publish env: BUILD_SOURCES_JAR: true CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} diff --git a/build.gradle b/build.gradle index c39e634d48..d355d064bf 100644 --- a/build.gradle +++ b/build.gradle @@ -402,16 +402,22 @@ publishMods { // configure the maven publication publishing { publications { - mavenJava(MavenPublication) { + create("mavenJava", MavenPublication) { + groupId = "de.hysky" + artifactId = base.archivesName from components.java } } // See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing. repositories { - // Add repositories to publish to here. - // Notice: This block does NOT have the same function as the block in the top level. - // The repositories here will be used for publishing your artifact, not for - // retrieving dependencies. + maven { + name = "GitHubPackages" + url = "https://maven.pkg.github.com/SkyblockerMod/Skyblocker" + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } } } From 3b15126d9834bf8defa2ca653b13f93ef7c30713 Mon Sep 17 00:00:00 2001 From: Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> Date: Mon, 24 Nov 2025 16:53:40 -0500 Subject: [PATCH 3/3] Copilot actually useful? --- .github/workflows/buildrelease.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/buildrelease.yml b/.github/workflows/buildrelease.yml index 8b5a355ee0..434688ca55 100644 --- a/.github/workflows/buildrelease.yml +++ b/.github/workflows/buildrelease.yml @@ -77,6 +77,7 @@ jobs: CHANGELOG: ${{ steps.read_changelog.outputs.changelog }} CHANGELOG_HIGHLIGHT: ${{ steps.read_changelog.outputs.changelog_highlight }} REF_NAME: ${{ github.ref_name }} + GITHUB_ACTOR: ${{ github.actor }} GITHUB_TOKEN: ${{ secrets.GH_RELEASE }} DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}