From c05397553592eab12b704e0789a95db775a07838 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Fri, 11 Aug 2023 11:42:13 +1000 Subject: [PATCH] Finish publish action --- .github/workflows/gradle.yml | 4 ---- .github/workflows/publish.yml | 8 +++----- build-logic/src/main/kotlin/extensions.kt | 9 +++++++++ gradle.properties | 4 +++- universal/build.gradle.kts | 11 ++++++++++- 5 files changed, 25 insertions(+), 11 deletions(-) diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index fb127966..5726a3ab 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -18,7 +18,3 @@ jobs: java-version: 11 - name: Build with Gradle run: ./gradlew build - - uses: actions/upload-artifact@v3 - with: - name: artifact - path: build/libs diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e96bb1bd..74e038e8 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,10 +10,8 @@ jobs: if: github.repository_owner == 'ViaVersion' runs-on: ubuntu-22.04 steps: - - name: Checkout Repository - uses: actions/checkout@v3 - - name: Validate Gradle Wrapper - uses: gradle/wrapper-validation-action@v1 + - uses: actions/checkout@v3 + - uses: gradle/wrapper-validation-action@v1 - name: Set up JDK 17 uses: actions/setup-java@v3 with: @@ -23,4 +21,4 @@ jobs: env: HANGAR_TOKEN: ${{ secrets.HANGAR_TOKEN }} MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }} - run: ./gradlew publishAllPublicationsToHangar # add 'modrinth' after it is approved + run: ./gradlew build modrinth publishAllPublicationsToHangar --stacktrace diff --git a/build-logic/src/main/kotlin/extensions.kt b/build-logic/src/main/kotlin/extensions.kt index 7fb95ba0..765412e0 100644 --- a/build-logic/src/main/kotlin/extensions.kt +++ b/build-logic/src/main/kotlin/extensions.kt @@ -56,6 +56,15 @@ fun Project.branchName(): String { return byteOut.toString(Charsets.UTF_8.name()).trim() } +fun Project.parseMinecraftSnapshotVersion(version: String): String? { + val separatorIndex = version.indexOf('-') + val lastSeparatorIndex = version.lastIndexOf('-') + if (separatorIndex == -1 || separatorIndex == lastSeparatorIndex) { + return null + } + return version.substring(separatorIndex + 1, lastSeparatorIndex) +} + fun JavaPluginExtension.javaTarget(version: Int) { sourceCompatibility = JavaVersion.toVersion(version) targetCompatibility = JavaVersion.toVersion(version) diff --git a/gradle.properties b/gradle.properties index 914ae341..93a62145 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,7 @@ projectVersion=4.8.0-23w32a-SNAPSHOT -mcVersions=1.20.1, 1.19.4, 1.18.2, 1.17.1, 1.16.5, 1.15.2, 1.14.4, 1.8.9 + +# Smile emoji +mcVersions=1.20.1, 1.20, 1.19.4, 1.19.3, 1.19.2, 1.19.1, 1.19, 1.18.2, 1.18.1, 1.18, 1.17.1, 1.17, 1.16.5, 1.16.4, 1.16.3, 1.16.2, 1.16.1, 1.16, 1.15.2, 1.15.1, 1.15, 1.14.4, 1.14.3, 1.14.2, 1.14.1, 1.14, 1.13.2, 1.13.1, 1.13, 1.12.2, 1.12.1, 1.12, 1.11.2, 1.11.1, 1.11, 1.10.2, 1.10.1, 1.10 mcVersionRange=1.10-1.20.1 waterfallVersion=1.20 velocityVersion=3.2 \ No newline at end of file diff --git a/universal/build.gradle.kts b/universal/build.gradle.kts index bb1c1b99..345c9847 100644 --- a/universal/build.gradle.kts +++ b/universal/build.gradle.kts @@ -48,21 +48,30 @@ val isMainBranch = branch == "master" val ver = (project.version as String) + "+" + System.getenv("GITHUB_RUN_NUMBER") val changelogContent = rootProject.lastCommitMessage() modrinth { + // val snapshotVersion = rootProject.parseMinecraftSnapshotVersion(project.version as String) val mcVersions: List = (property("mcVersions") as String) .split(",") .map { it.trim() } + //.let { if (snapshotVersion != null) it + snapshotVersion else it } // We're usually too fast for modrinth + token.set(System.getenv("MODRINTH_TOKEN")) projectId.set("viabackwards") versionType.set(if (isMainBranch) "beta" else "alpha") versionNumber.set(ver) - versionName.set("[$branch] $ver") + versionName.set(ver) changelog.set(changelogContent) uploadFile.set(tasks.shadowJar.flatMap { it.archiveFile }) gameVersions.set(mcVersions) loaders.add("fabric") + loaders.add("paper") + loaders.add("folia") + loaders.add("velocity") + loaders.add("bungeecord") + loaders.add("sponge") autoAddDependsOn.set(false) detectLoaders.set(false) dependencies { + optional.project("viaversion") optional.project("viafabric") optional.project("viafabricplus") }