mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-14 09:56:37 -04:00
build: always print unclean status when initializing git
This commit is contained in:
parent
aa12de78ac
commit
bef2f86138
@ -63,6 +63,7 @@ test:
|
|||||||
reports:
|
reports:
|
||||||
junit: build/test-results/**/TEST-*.xml
|
junit: build/test-results/**/TEST-*.xml
|
||||||
|
|
||||||
|
# TODO: upload release in the publish step?
|
||||||
package:
|
package:
|
||||||
stage: package
|
stage: package
|
||||||
script:
|
script:
|
||||||
|
@ -431,6 +431,9 @@ tasks.test {
|
|||||||
var git: Grgit? = null
|
var git: Grgit? = null
|
||||||
var commit: Commit? = null
|
var commit: Commit? = null
|
||||||
|
|
||||||
|
|
||||||
|
fun Commit.shortId() = id.substring(0, 10)
|
||||||
|
|
||||||
fun loadGit() {
|
fun loadGit() {
|
||||||
val git: Grgit
|
val git: Grgit
|
||||||
try {
|
try {
|
||||||
@ -447,10 +450,12 @@ fun loadGit() {
|
|||||||
stable = true
|
stable = true
|
||||||
tag.name
|
tag.name
|
||||||
} else {
|
} else {
|
||||||
commit.id.substring(0, 10)
|
commit.shortId()
|
||||||
}
|
}
|
||||||
if (!git.status().isClean) {
|
val status = git.status()
|
||||||
|
if (!status.isClean) {
|
||||||
nextVersion += "-dirty"
|
nextVersion += "-dirty"
|
||||||
|
println(status)
|
||||||
}
|
}
|
||||||
if (project.version != nextVersion) {
|
if (project.version != nextVersion) {
|
||||||
project.version = nextVersion
|
project.version = nextVersion
|
||||||
@ -466,13 +471,10 @@ val versionJsonTask = tasks.register("versionJson") {
|
|||||||
doFirst {
|
doFirst {
|
||||||
fun generateGit(git: Grgit, commit: Commit): Map<String, Any> {
|
fun generateGit(git: Grgit, commit: Commit): Map<String, Any> {
|
||||||
val status = git.status()
|
val status = git.status()
|
||||||
if (!status.isClean) {
|
|
||||||
println(status)
|
|
||||||
}
|
|
||||||
return mapOf(
|
return mapOf(
|
||||||
"branch" to (System.getenv()["CI_COMMIT_BRANCH"] ?: git.branch.current().name),
|
"branch" to (System.getenv()["CI_COMMIT_BRANCH"] ?: git.branch.current().name),
|
||||||
"commit" to commit.id,
|
"commit" to commit.id,
|
||||||
"commit_short" to commit.abbreviatedId,
|
"commit_short" to commit.shortId(),
|
||||||
"dirty" to !status.isClean,
|
"dirty" to !status.isClean,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user