diff --git a/build-and-deploy.sh b/build-and-deploy.sh deleted file mode 100755 index 9a15778..0000000 --- a/build-and-deploy.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -if [ "$#" -ne 1 ]; then - echo "Usage: ./build-and-deploy.sh {target}" - echo "Script needs target hostname or ip as parameter" - exit 1 -fi - -./gradlew clean build jibBuildTar && scp app/build/github-release-bot.tar "$1":/opt/stacks/github-release-bot/ diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..80e8665 --- /dev/null +++ b/go.mod @@ -0,0 +1,5 @@ +module codeberg.org/ryan_harg/github-release-bot + +go 1.22.5 + +require github.com/magefile/mage v1.15.0 diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..4ee1b87 --- /dev/null +++ b/go.sum @@ -0,0 +1,2 @@ +github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg= +github.com/magefile/mage v1.15.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A= diff --git a/magefile.go b/magefile.go new file mode 100644 index 0000000..fc0dff7 --- /dev/null +++ b/magefile.go @@ -0,0 +1,21 @@ +//go:build mage + +package main + +import ( + "github.com/magefile/mage/mg" + "github.com/magefile/mage/sh" +) + +const app = "github-release-bot" + +// Builds and exports the application as a docker image tar file. +func build() error { + return sh.RunV("./gradlew", "build", "jibBuildTar") +} + +// Deploys the application to a specified host via scp. +func Deploy(host string) error { + mg.Deps(build) + return sh.RunV("scp", "app/build/"+app+".tar", host+":/opt/stacks/"+app+"/") +}