add deployments

This commit is contained in:
Alexander Nozik 2022-07-17 10:05:06 +03:00
parent 7e0acaeca9
commit a8b304bd20
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
2 changed files with 50 additions and 0 deletions

39
.space.kts Normal file
View File

@ -0,0 +1,39 @@
import kotlin.io.path.readText
job("Build") {
gradlew("openjdk:11", "build")
}
job("Publish") {
startOn {
gitPush { enabled = false }
}
container("openjdk:11") {
env["SPACE_USER"] = Secrets("space_user")
env["SPACE_TOKEN"] = Secrets("space_token")
kotlinScript { api ->
val spaceUser = System.getenv("SPACE_USER")
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(
project = api.projectIdentifier(),
targetIdentifier = TargetIdentifier.Key("maps-kt"),
version = version,
// automatically update deployment status based on a status of a job
syncWithAutomationJob = true
)
api.gradlew(
"publishAllPublicationsToSpaceRepository",
"-Ppublishing.space.user=\"$spaceUser\"",
"-Ppublishing.space.token=\"$spaceToken\"",
)
}
}
}

View File

@ -4,6 +4,17 @@ plugins {
val ktorVersion by extra("2.0.3") val ktorVersion by extra("2.0.3")
tasks.create("version") {
group = "publishing"
val versionFile = project.buildDir.resolve("project-version.txt")
outputs.file(versionFile)
doLast {
versionFile.createNewFile()
versionFile.writeText(project.version.toString())
println(project.version)
}
}
subprojects { subprojects {
group = "center.sciprog" group = "center.sciprog"
version = "0.1.0-SNAPSHOT" version = "0.1.0-SNAPSHOT"