ci: fix change detection - use git diff HEAD origin/main
All checks were successful
BotServer CI/CD / build (push) Successful in 1m6s
All checks were successful
BotServer CI/CD / build (push) Successful in 1m6s
This commit is contained in:
parent
4e60bed7b7
commit
385993bc67
1 changed files with 22 additions and 9 deletions
|
|
@ -118,16 +118,29 @@ jobs:
|
||||||
sleep 1
|
sleep 1
|
||||||
sccache --start-server
|
sccache --start-server
|
||||||
|
|
||||||
# Check if there are changes to rebuild
|
# Check if there are changes to rebuild (check botserver submodule)
|
||||||
CHANGES=$(git -C /opt/gbo/data/botserver/botserver diff origin/main --name-only 2>/dev/null || echo "changed")
|
cd /opt/gbo/data/botserver/botserver
|
||||||
|
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
|
if [ -z "$CHANGES" ]; then
|
||||||
echo "No changes detected in botserver, checking if binary exists..."
|
echo "No changes detected in botserver submodule"
|
||||||
if [ -f /opt/gbo/data/botserver/target/debug/botserver ]; then
|
else
|
||||||
echo "Binary already exists, skipping build"
|
echo "Changes detected in botserver, will rebuild"
|
||||||
echo "=== sccache stats (before) ==="
|
fi
|
||||||
sccache --show-stats || true
|
|
||||||
exit 0
|
cd /opt/gbo/data/botserver
|
||||||
fi
|
|
||||||
|
# Build only if there are changes OR binary doesn't exist
|
||||||
|
if [ -z "$CHANGES" ] && [ -f /opt/gbo/data/botserver/target/debug/botserver ]; then
|
||||||
|
echo "Binary already exists and no changes, skipping build"
|
||||||
|
echo "=== sccache stats ==="
|
||||||
|
sccache --show-stats || true
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "=== Starting build in background ==="
|
echo "=== Starting build in background ==="
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue