Skip to content

Commit

Permalink
Finish publish action
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Aug 11, 2023
1 parent 70725d4 commit c053975
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 3 additions & 5 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
9 changes: 9 additions & 0 deletions build-logic/src/main/kotlin/extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -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
11 changes: 10 additions & 1 deletion universal/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> = (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")
}
Expand Down

0 comments on commit c053975

Please sign in to comment.