2024-07-11 10:29:54 +02:00
|
|
|
//go:build mage
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/magefile/mage/mg"
|
|
|
|
"github.com/magefile/mage/sh"
|
|
|
|
)
|
|
|
|
|
|
|
|
const app = "github-release-bot"
|
|
|
|
|
2024-09-16 13:51:36 +02:00
|
|
|
// Build builds the application.
|
2024-07-26 10:25:20 +02:00
|
|
|
func Build() error {
|
2024-09-16 13:51:36 +02:00
|
|
|
return sh.RunV("./gradlew", "clean", "build")
|
|
|
|
}
|
|
|
|
|
|
|
|
// BuildImage builds a docke rimage and exports it as a tar file.
|
|
|
|
func BuildImage() error {
|
|
|
|
mg.Deps(Build)
|
|
|
|
return sh.RunV("./gradlew", "jibBuildTar")
|
2024-07-11 10:29:54 +02:00
|
|
|
}
|
|
|
|
|
2024-07-26 10:25:20 +02:00
|
|
|
// Deploy deploys the application to a specified host via scp.
|
2024-07-11 10:29:54 +02:00
|
|
|
func Deploy(host string) error {
|
2024-09-16 13:51:36 +02:00
|
|
|
mg.Deps(BuildImage)
|
2024-07-11 10:29:54 +02:00
|
|
|
return sh.RunV("scp", "app/build/"+app+".tar", host+":/opt/stacks/"+app+"/")
|
|
|
|
}
|