2022-07-10 11:46:20 +03:00
|
|
|
job("Build") {
|
|
|
|
gradlew("openjdk:11", "build")
|
|
|
|
}
|
|
|
|
|
|
|
|
job("Publish"){
|
|
|
|
startOn {
|
|
|
|
gitPush { enabled = false }
|
|
|
|
}
|
2022-07-10 12:01:20 +03:00
|
|
|
container("openjdk:11") {
|
2022-07-10 12:42:14 +03:00
|
|
|
env["SPACE_USER"] = Secrets("space_user")
|
|
|
|
env["SPACE_TOKEN"] = Secrets("space_token")
|
2022-07-10 12:01:20 +03:00
|
|
|
kotlinScript { api ->
|
2022-07-10 12:42:14 +03:00
|
|
|
val spaceUser = System.getenv("SPACE_USER")
|
|
|
|
val spaceToken = System.getenv("SPACE_TOKEN")
|
|
|
|
|
2022-07-10 12:01:20 +03:00
|
|
|
api.space().projects.automation.deployments.start(
|
|
|
|
project = api.projectIdentifier(),
|
|
|
|
targetIdentifier = TargetIdentifier.Key("gradle-tools"),
|
|
|
|
version = "current",
|
|
|
|
// automatically update deployment status based on a status of a job
|
|
|
|
syncWithAutomationJob = true
|
|
|
|
)
|
2022-07-10 12:42:14 +03:00
|
|
|
api.gradlew(
|
|
|
|
"publishAllPublicationsToSpaceRepository",
|
|
|
|
"-Ppublishing.space.user=\"$spaceUser\"",
|
|
|
|
"-Ppublishing.space.token=\"$spaceToken\"",
|
|
|
|
)
|
2022-07-10 12:01:20 +03:00
|
|
|
}
|
|
|
|
}
|
2022-07-10 11:46:20 +03:00
|
|
|
}
|