Use Alpha channel in non-master branch

This commit is contained in:
Nassim Jahnke 2024-03-06 14:20:33 +01:00
parent d6dec0ff11
commit 6d175f8bc7
No known key found for this signature in database
GPG Key ID: EF6771C01F6EF02F
2 changed files with 13 additions and 1 deletions

View File

@ -3,6 +3,7 @@ on:
push:
branches:
- master
- dev
jobs:
publish:

View File

@ -80,16 +80,27 @@ def latestCommitMessage() {
return byteOut.toString('UTF-8').trim()
}
def branchName() {
def byteOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--abbrev-ref', 'HEAD'
standardOutput = byteOut
}
return byteOut.toString('UTF-8').trim()
}
def baseVersion = project.maven_version
def isRelease = !baseVersion.contains('-')
def suffixedVersion = isRelease ? baseVersion : baseVersion + "+" + System.getenv("GITHUB_RUN_NUMBER")
def commitHash = latestCommitHash()
def changelogContent = "[${commitHash}](https://github.com/ViaVersion/iaRewind-Legacy-Support/commit/${commitHash}) ${latestCommitMessage()}"
def branch = branchName()
def isMainBranch = branch == "master"
hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
id.set("ViaRewindLegacySupport")
channel.set(isRelease ? "Release" : "Snapshot")
channel.set(isRelease ? "Release" : isMainBranch ? "Snapshot" : "Alpha")
changelog.set(changelogContent)
apiKey.set(System.getenv("HANGAR_TOKEN"))
platforms {