From 72c5467ae2200bf16041fc53de461ac4fa1098bb Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 11 Mar 2024 17:55:13 -0500 Subject: [PATCH] Make handler() send more status messages over Matrix (fix #14) --- main.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 03f18bb..cd3cf95 100644 --- a/main.go +++ b/main.go @@ -35,16 +35,20 @@ func handler(data map[string]interface{}) { deploy_error.SendOverMatrix(); return } if exists { + sendMessage(MatrixMessage{text: "⚪️ Updating repository..."}) if deploy_error := site.Update(); deploy_error.code != 0 { deploy_error.SendOverMatrix(); return } + sendMessage(MatrixMessage{text: "⚪️ Restarting server..."}) if deploy_error := site.Restart(); deploy_error.code != 0 { deploy_error.SendOverMatrix(); return } - } else { + } else { + sendMessage(MatrixMessage{text: "⚪️ Cloning repository..."}) if deploy_error := CloneSite(repository["ssh_url"].(string), repo_name); deploy_error.code != 0 { deploy_error.SendOverMatrix(); return } + sendMessage(MatrixMessage{text: "⚪️ Starting server..."}) if site, exists, err = getSite(repo_name); err != nil { deploy_error := newDeployError(1, "handler", "Failed to get site '%s' after creation!", fmt.Sprint(err)) deploy_error.SendOverMatrix() @@ -52,6 +56,7 @@ func handler(data map[string]interface{}) { if deploy_error := site.Start(); deploy_error.code != 0 { deploy_error.SendOverMatrix(); return } + defer sendMessage(MatrixMessage{text: "🚀 Launched for the first time!"}) } sendMessage(MatrixMessage{text: "🟢 Deployed successfully!"}) }