diff --git a/.forgejo/workflows/build-release.yml b/.forgejo/workflows/build-release.yml index badc473..78b2453 100644 --- a/.forgejo/workflows/build-release.yml +++ b/.forgejo/workflows/build-release.yml @@ -17,6 +17,10 @@ jobs: id: vars run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT + - name: Set git tag description + id: vars2 + run: echo "tag_desc=$(git for-each-ref --format='%(contents)' $GITHUB_REF)" >> $GITHUB_OUTPUT + - name: Check outputs run: echo @@ -30,25 +34,30 @@ jobs: name: Setup Gradle env: GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }} + GIT_TAG: ${{ steps.vars2.outputs.tag_desc }} - run: ./gradlew runDatagen name: Generate assets env: GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }} + GIT_TAG: ${{ steps.vars2.outputs.tag_desc }} - run: ./gradlew build name: Build project env: GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }} + GIT_TAG: ${{ steps.vars2.outputs.tag_desc }} - run: ./gradlew publish name: Upload env: GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }} + GIT_TAG: ${{ steps.vars2.outputs.tag_desc }} PACKAGE_REPO_KEY: ${{ secrets.PACKAGE_REPO_KEY }} - run: ./gradlew modrinth name: Publish to Modrinth env: GIT_SHA_SHORT: ${{ steps.vars.outputs.sha_short }} + GIT_TAG: ${{ steps.vars2.outputs.tag_desc }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} diff --git a/build.gradle.kts b/build.gradle.kts index 88e08b6..74a6c40 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -30,10 +30,12 @@ plugins { id("com.modrinth.minotaur") version "2.+" } +val git_ref = System.getenv("GITHUB_REF_NAME") ?: "Not found" + val ver = if ((System.getenv("GITHUB_REF") ?: "local").startsWith("refs/tags/")) System.getenv("GITHUB_REF_NAME") ?: "err" else System.getenv("GIT_SHA_SHORT") ?: "0.0.0" -val mavenVersion = "$ver-${project.ext["minecraft.version"] as String}" +val mavenVersion = ver val modId: String by project val modName: String by project @@ -211,11 +213,12 @@ publishing { modrinth { token.set(System.getenv("MODRINTH_TOKEN")) // Remember to have the MODRINTH_TOKEN environment variable set or else this will fail - just make sure it stays private! projectId.set(modId) // This can be the project ID or the slug. Either will work! - versionNumber.set(System.getenv(mavenVersion)) // You don't need to set this manually. Will fail if Modrinth has this version already + versionNumber.set("$modName ${System.getenv(mavenVersion)} for $minecraftVersion") // You don't need to set this manually. Will fail if Modrinth has this version already versionType.set("alpha") // This is the default -- can also be `beta` or `alpha` uploadFile.set(tasks.remapJar) // With Loom, this MUST be set to `remapJar` instead of `jar`! gameVersions.addAll(listOf(project.ext["minecraft.version"] as String)) // Must be an array, even with only one version loaders.add("fabric") // Must also be an array - no need to specify this if you're using Loom or ForgeGradle + description = System.getenv("GIT_TAG") ?: "Could not get tag description" dependencies { // A special DSL for creating dependencies // scope.type // The scope can be `required`, `optional`, `incompatible`, or `embedded`