ci: fix change detection - compare commits not diff
All checks were successful
BotServer CI/CD / build (push) Successful in 1m3s
All checks were successful
BotServer CI/CD / build (push) Successful in 1m3s
This commit is contained in:
parent
385993bc67
commit
768a3f6f82
1 changed files with 11 additions and 15 deletions
|
|
@ -121,28 +121,24 @@ jobs:
|
||||||
# Check if there are changes to rebuild (check botserver submodule)
|
# Check if there are changes to rebuild (check botserver submodule)
|
||||||
cd /opt/gbo/data/botserver/botserver
|
cd /opt/gbo/data/botserver/botserver
|
||||||
git fetch origin main
|
git fetch origin main
|
||||||
# Compare against origin/main - show what would be deployed
|
|
||||||
CHANGES=$(git diff HEAD origin/main --name-only 2>/dev/null | head -20 || echo "")
|
|
||||||
echo "=== Changes detected in botserver ==="
|
|
||||||
echo "$CHANGES"
|
|
||||||
echo "======================================="
|
|
||||||
|
|
||||||
if [ -z "$CHANGES" ]; then
|
# Get current commit and origin/main commit
|
||||||
echo "No changes detected in botserver submodule"
|
CURRENT_COMMIT=$(git rev-parse HEAD 2>/dev/null || echo "")
|
||||||
else
|
ORIGIN_COMMIT=$(git rev-parse origin/main 2>/dev/null || echo "")
|
||||||
echo "Changes detected in botserver, will rebuild"
|
echo "Current commit: $CURRENT_COMMIT"
|
||||||
fi
|
echo "Origin commit: $ORIGIN_COMMIT"
|
||||||
|
|
||||||
cd /opt/gbo/data/botserver
|
# Compare commits - if different, there are changes to deploy
|
||||||
|
if [ "$CURRENT_COMMIT" = "$ORIGIN_COMMIT" ] && [ -f /opt/gbo/data/botserver/target/debug/botserver ]; then
|
||||||
# Build only if there are changes OR binary doesn't exist
|
echo "No changes - already at origin/main and binary exists, skipping build"
|
||||||
if [ -z "$CHANGES" ] && [ -f /opt/gbo/data/botserver/target/debug/botserver ]; then
|
|
||||||
echo "Binary already exists and no changes, skipping build"
|
|
||||||
echo "=== sccache stats ==="
|
echo "=== sccache stats ==="
|
||||||
sccache --show-stats || true
|
sccache --show-stats || true
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo "Changes detected or no binary - will build"
|
||||||
|
|
||||||
|
cd /opt/gbo/data/botserver
|
||||||
echo "=== Starting build in background ==="
|
echo "=== Starting build in background ==="
|
||||||
cargo build -p botserver -j 8 > /tmp/build.log 2>&1 &
|
cargo build -p botserver -j 8 > /tmp/build.log 2>&1 &
|
||||||
BUILD_PID=$!
|
BUILD_PID=$!
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue