Try to catch project version
This commit is contained in:
parent
3565a03d57
commit
1c80eeb2c7
11
.space.kts
11
.space.kts
@ -1,3 +1,5 @@
|
|||||||
|
import kotlin.io.path.readText
|
||||||
|
|
||||||
job("Build") {
|
job("Build") {
|
||||||
gradlew("openjdk:11", "build")
|
gradlew("openjdk:11", "build")
|
||||||
}
|
}
|
||||||
@ -10,13 +12,20 @@ job("Publish"){
|
|||||||
env["SPACE_USER"] = Secrets("space_user")
|
env["SPACE_USER"] = Secrets("space_user")
|
||||||
env["SPACE_TOKEN"] = Secrets("space_token")
|
env["SPACE_TOKEN"] = Secrets("space_token")
|
||||||
kotlinScript { api ->
|
kotlinScript { api ->
|
||||||
|
|
||||||
val spaceUser = System.getenv("SPACE_USER")
|
val spaceUser = System.getenv("SPACE_USER")
|
||||||
val spaceToken = System.getenv("SPACE_TOKEN")
|
val spaceToken = System.getenv("SPACE_TOKEN")
|
||||||
|
|
||||||
|
// write version to the build directory
|
||||||
|
api.gradlew("version")
|
||||||
|
|
||||||
|
//read version from build file
|
||||||
|
val version = java.nio.file.Path.of("build/project-version.txt").readText()
|
||||||
|
|
||||||
api.space().projects.automation.deployments.start(
|
api.space().projects.automation.deployments.start(
|
||||||
project = api.projectIdentifier(),
|
project = api.projectIdentifier(),
|
||||||
targetIdentifier = TargetIdentifier.Key("gradle-tools"),
|
targetIdentifier = TargetIdentifier.Key("gradle-tools"),
|
||||||
version = api.gitRevision(),
|
version = version,
|
||||||
// automatically update deployment status based on a status of a job
|
// automatically update deployment status based on a status of a job
|
||||||
syncWithAutomationJob = true
|
syncWithAutomationJob = true
|
||||||
)
|
)
|
||||||
|
@ -95,6 +95,16 @@ gradlePlugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.create("version") {
|
||||||
|
val versionFile = project.buildDir.resolve("project-version.txt")
|
||||||
|
outputs.file(versionFile)
|
||||||
|
doLast {
|
||||||
|
versionFile.createNewFile()
|
||||||
|
versionFile.writeText(project.version.toString())
|
||||||
|
println(project.version)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//publishing version catalog
|
//publishing version catalog
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
|
Loading…
Reference in New Issue
Block a user