fix: build tool from script directory (correct go.mod context)
This commit is contained in:
parent
533b6f4137
commit
02bab22a5d
1 changed files with 4 additions and 8 deletions
12
deploy.sh
12
deploy.sh
|
|
@ -37,6 +37,7 @@ else
|
|||
fi
|
||||
|
||||
# --- Common: pull + build ---
|
||||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
cd "$REPO_DIR"
|
||||
echo "[1/6] Pulling latest code..."
|
||||
git pull
|
||||
|
|
@ -45,15 +46,10 @@ echo "[2/6] Building binary and helper tool..."
|
|||
export PATH=$PATH:/usr/local/go/bin
|
||||
go build -o "$BINARY_NAME" .
|
||||
|
||||
# Build helper tool from script directory (has correct go.mod with all deps)
|
||||
TOOL_BIN="/tmp/nextwks-tool"
|
||||
TOOL_SRC=""
|
||||
for TRY_DIR in "$REPO_DIR/tools/nextwks-tool" "$(dirname $0)/tools/nextwks-tool"; do
|
||||
if [ -d "$TRY_DIR" ]; then
|
||||
TOOL_SRC="$TRY_DIR"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -n "$TOOL_SRC" ]; then
|
||||
TOOL_SRC="$SCRIPT_DIR/tools/nextwks-tool"
|
||||
if [ -d "$TOOL_SRC" ]; then
|
||||
cd "$TOOL_SRC"
|
||||
go build -o "$TOOL_BIN" . 2>&1 && echo "[OK] Helper tool built" || echo "[WARN] Helper tool build failed"
|
||||
cd "$REPO_DIR"
|
||||
|
|
|
|||
Loading…
Reference in a new issue