2
0
mirror of https://github.com/proxiodev/RedisBungee.git synced 2025-04-20 01:27:07 +00:00

test vars from github

This commit is contained in:
mohammed jasem alaajel 2023-03-23 15:21:26 +04:00
parent 693b7e6d71
commit c0470dfaf0
No known key found for this signature in database
2 changed files with 19 additions and 8 deletions

View File

@ -22,7 +22,7 @@ jobs:
java-version: '11' java-version: '11'
distribution: 'adopt' distribution: 'adopt'
- name: Build with gradle - name: Build with gradle
run: ./gradlew build run: ./gradlew build -Dbranch=${{ github.ref }}
- name: shadowJar with gradle - name: shadowJar with gradle
run: ./gradlew shadowJar run: ./gradlew shadowJar
- name: Upload Bungee - name: Upload Bungee

View File

@ -32,20 +32,31 @@ description = "RedisBungee interafaces"
blossom { blossom {
replaceToken("@version@", "$version") replaceToken("@version@", "$version")
// GIT // GIT
var branch: String = ""
var commit: String = ""
val branchProp = System.getProperty("branch")
if (branchProp != null) {
branch = branchProp;
} else {
val branchStdout = ByteArrayOutputStream() val branchStdout = ByteArrayOutputStream()
rootProject.exec { rootProject.exec {
standardOutput = branchStdout standardOutput = branchStdout
commandLine("git", "branch", "--show-current") commandLine("git", "branch", "--show-current")
} }
branch = branchStdout.toString().replace("\n", "")
branchStdout.close()
}
val commitStdout = ByteArrayOutputStream() val commitStdout = ByteArrayOutputStream()
rootProject.exec { rootProject.exec {
standardOutput = commitStdout standardOutput = commitStdout
commandLine("git", "rev-parse", "HEAD") commandLine("git", "rev-parse", "HEAD")
} }
replaceToken("@git_branch@", "$branchStdout".replace("\n", "")) commit = "$commitStdout".replace("\n", "");
replaceToken("@git_commit@", "$commitStdout".replace("\n", ""))
branchStdout.close()
commitStdout.close() commitStdout.close()
replaceToken("@git_branch@", branch)
replaceToken("@git_commit@", commit)
} }
java { java {