Finish publishing action

This commit is contained in:
Nassim Jahnke 2023-08-11 12:28:38 +10:00
parent 34509e86c0
commit 8bad8a10be
4 changed files with 22 additions and 14 deletions

View File

@ -21,8 +21,3 @@ jobs:
java-version: 11
- name: Build with Gradle
run: ./gradlew build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: artifact
path: build/libs

View File

@ -23,4 +23,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

View File

@ -1,6 +1,8 @@
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
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, 1.9.4, 1.9.3, 1.9.2, 1.9.1, 1.9, 1.8.9
mcVersionRange=1.8-1.20.1
waterfallVersion=1.20
velocityVersion=3.2

View File

@ -44,8 +44,14 @@ tasks {
publishShadowJar()
val branch = rootProject.branchName()
val ver = (project.version as String) + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = rootProject.lastCommitMessage()
val baseVersion = project.version as String
val isRelease = !baseVersion.contains('-')
val suffixedVersion = if (isRelease) baseVersion else baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
val changelogContent = if (isRelease) {
"See [GitHub](https://github.com/ViaVersion/ViaVersion) for release notes."
} else {
rootProject.lastCommitMessage()
}
val isMainBranch = branch == "master"
modrinth {
val mcVersions: List<String> = (property("mcVersions") as String)
@ -53,13 +59,18 @@ modrinth {
.map { it.trim() }
token.set(System.getenv("MODRINTH_TOKEN"))
projectId.set("viaversion")
versionType.set(if (isMainBranch) "beta" else "alpha")
versionNumber.set(ver)
versionName.set("[$branch] $ver")
versionType.set(if (isRelease) "release" else if (isMainBranch) "beta" else "alpha")
versionNumber.set(suffixedVersion)
versionName.set(suffixedVersion)
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 {
@ -71,9 +82,9 @@ modrinth {
if (isMainBranch) { // Don't spam releases until Hangar has per channel notifications
hangarPublish {
publications.register("plugin") {
version.set(ver)
version.set(suffixedVersion)
namespace("ViaVersion", "ViaVersion")
channel.set(if (isMainBranch) "Snapshot" else "Alpha")
channel.set(if (isRelease) "Release" else if (isMainBranch) "Snapshot" else "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {