From 2324e9d81bbe2a18eba7973abea1dbc06335a652 Mon Sep 17 00:00:00 2001 From: Alexander Nozik Date: Sun, 19 Jun 2022 19:36:48 +0300 Subject: [PATCH] Fix deploy --- .gitignore | 1 + .space.kts | 5 ++--- build.gradle.kts | 13 ++++++++----- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 2e1f3e2..6adcccd 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ build/ /logs/ !gradle/wrapper/gradle-wrapper.jar +/deploy.ps1 diff --git a/.space.kts b/.space.kts index a013664..d0603e7 100644 --- a/.space.kts +++ b/.space.kts @@ -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") } } } \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts index f917281..cea197c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") } \ No newline at end of file