Fix deploy

This commit is contained in:
Alexander Nozik 2022-06-19 19:36:48 +03:00
parent 2990e2f28f
commit 2324e9d81b
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
3 changed files with 11 additions and 8 deletions

1
.gitignore vendored
View File

@ -4,3 +4,4 @@ build/
/logs/
!gradle/wrapper/gradle-wrapper.jar
/deploy.ps1

View File

@ -8,8 +8,7 @@ job("Deploy") {
env["SPC_USER"] = Secrets("spc-webmaster-user")
env["SPC_ID"] = Secrets("spc-webmaster-id")
kotlinScript { api ->
api.gradlew("uploadDistribution")
api.gradlew("reloadDistribution")
api.gradle("uploadDistribution reloadDistribution")
}
}
}
@ -24,7 +23,7 @@ job("Restart service"){
env["SPC_USER"] = Secrets("spc-webmaster-user")
env["SPC_ID"] = Secrets("spc-webmaster-id")
kotlinScript { api ->
api.gradlew("reloadDistribution")
api.gradle("reloadDistribution")
}
}
}

View File

@ -73,17 +73,17 @@ tasks.getByName("processResources").dependsOn(writeBuildDate)
/* Upload with JSch */
val host = System.getProperty("SPC_HOST")
val user = System.getProperty("SPC_USER")
val identity = System.getProperty("SPC_ID")
val host = System.getenv("SPC_HOST")
val user = System.getenv("SPC_USER")
val identity = System.getenv("SPC_ID")
if (host != null && user != null && identity != null) {
if (host != null && user != null || identity != null) {
val uploadDistribution by tasks.creating {
group = "distribution"
dependsOn("installDist")
doLast {
sshUploadDirectory(buildDir.resolve("install"), host, user, "/opt") {
addIdentity("spc-webmaster.key", identity.encodeToByteArray(), null, null)
addIdentity("spc-webmaster", identity.encodeToByteArray(), null, null)
}
}
}
@ -96,4 +96,7 @@ if (host != null && user != null && identity != null) {
}
}
}
}else {
logger.error("Host, user or ID are not defined")
}