Migate build and deploy to Mage
This commit is contained in:
parent
b2c60a0a6a
commit
2210b89f85
4 changed files with 28 additions and 8 deletions
|
@ -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/
|
5
go.mod
Normal file
5
go.mod
Normal file
|
@ -0,0 +1,5 @@
|
|||
module codeberg.org/ryan_harg/github-release-bot
|
||||
|
||||
go 1.22.5
|
||||
|
||||
require github.com/magefile/mage v1.15.0
|
2
go.sum
Normal file
2
go.sum
Normal file
|
@ -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=
|
21
magefile.go
Normal file
21
magefile.go
Normal file
|
@ -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+"/")
|
||||
}
|
Loading…
Reference in a new issue