spc-site/.space.kts

50 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-05-25 21:23:56 +03:00
import circlet.pipelines.script.put
2022-05-22 16:52:36 +03:00
job("Deploy") {
2022-05-25 18:40:23 +03:00
startOn {
gitPush { enabled = false }
2022-05-22 16:52:36 +03:00
}
2022-05-25 18:40:23 +03:00
2022-05-25 21:23:56 +03:00
container(image = "openjdk:11") {
kotlinScript { api ->
api.gradlew("installDist")
api.fileShare().put(java.io.File("build/install"))
}
}
2022-05-25 18:40:23 +03:00
2022-05-25 21:23:56 +03:00
container(image = "openjdk:11") {
2022-05-25 18:40:23 +03:00
env["HOST"] = Params("spc-host")
env["USER"] = Secrets("spc-webmaster-user")
env["ID"] = Secrets("spc-webmaster-id")
2022-05-22 16:52:36 +03:00
shellScript {
interpreter = "/bin/bash"
2022-05-25 21:52:55 +03:00
content = """
2022-06-01 10:47:00 +03:00
echo ${'$'}ID > id.key
2022-06-15 19:18:29 +03:00
chmod 400 id.key
2022-06-01 10:47:00 +03:00
scp -r -i id.key /mnt/space/share/spc-site/ "${'$'}USER@${'$'}HOST:/opt"
2022-05-25 21:52:55 +03:00
""".trimIndent()
2022-05-22 16:52:36 +03:00
}
}
2022-06-15 19:29:59 +03:00
}
job("Restart service"){
startOn {
gitPush { enabled = false }
}
container(image = "openjdk:11") {
env["HOST"] = Params("spc-host")
env["USER"] = Secrets("spc-webmaster-user")
env["ID"] = Secrets("spc-webmaster-id")
shellScript {
interpreter = "/bin/bash"
content = """
echo ${'$'}ID > id.key
chmod 400 id.key
ssh -i id.key -t "${'$'}USER@${'$'}HOST" "systemctl restart sciprog-site"
""".trimIndent()
}
}
2022-05-22 16:52:36 +03:00
}