From 0e2d817eb8fcd86f927a01510ee58269cf515d54 Mon Sep 17 00:00:00 2001 From: paketo-bot Date: Wed, 27 Mar 2024 13:27:52 +0000 Subject: [PATCH] Updating github-config --- scripts/build.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/scripts/build.sh b/scripts/build.sh index a3e1d3d..bf99005 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -56,7 +56,15 @@ function run::build() { echo "Success!" - for name in detect build; do + names=("detect") + + if [ -f "extension.toml" ]; then + names+=("generate") + else + names+=("build") + fi + + for name in "${names[@]}"; do printf "%s" "Linking ${name}... " ln -sf "run" "${name}" @@ -73,16 +81,20 @@ function cmd::build() { for src in "${BUILDPACKDIR}"/cmd/*; do name="$(basename "${src}")" - printf "%s" "Building ${name}... " + if [[ -f "${src}/main.go" ]]; then + printf "%s" "Building ${name}... " - GOOS="linux" \ - CGO_ENABLED=0 \ - go build \ - -ldflags="-s -w" \ - -o "${BUILDPACKDIR}/bin/${name}" \ - "${src}/main.go" + GOOS="linux" \ + CGO_ENABLED=0 \ + go build \ + -ldflags="-s -w" \ + -o "${BUILDPACKDIR}/bin/${name}" \ + "${src}/main.go" - echo "Success!" + echo "Success!" + else + printf "%s" "Skipping ${name}... " + fi done fi }