helper to compile from source

This commit is contained in:
Earl Warren 2023-04-05 14:49:04 +02:00
parent e97991ef78
commit 05c2b60cc5
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -9,6 +9,36 @@ DIR=$(mktemp -d)
trap "rm -fr $DIR" EXIT trap "rm -fr $DIR" EXIT
function dependency_go() {
if ! which go > /dev/null ; then
apt-get update
apt-get install -y -qq wget tar
wget https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
tar zxf go1.20.3.linux-amd64.tar.gz
export PATH=$PATH:$(pwd)/go/bin
fi
}
function checkout() {
local git="$1"
if ! test -d forgejo-runner ; then
git clone $git forgejo-runner
fi
}
function build() {
local git="$1"
local version="$2"
(
checkout "$git"
cd forgejo-runner
git checkout "$version"
make build
export PATH=$PATH:$(pwd)
)
}
function api() { function api() {
method=$1 method=$1
shift shift