- Add git rebase --abort to clear any stuck rebase state - Then reset --hard + clean - Prevents 'rebase in progress' errors
67 lines
2 KiB
YAML
67 lines
2 KiB
YAML
# HASH-BUSTER-20260418-CONTAINER-v19
|
|
# Dev machine approach: /opt/gbo/work/botserver
|
|
# Pre-installed globally: Rust, Node.js, Python, sccache
|
|
# ABORT any rebase first, then reset + pull
|
|
name: BotServer CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
env:
|
|
SCCACHE_DIR: /opt/gbo/work/.sccache
|
|
CARGO_TARGET_DIR: /opt/gbo/work/target
|
|
RUSTC_WRAPPER: sccache
|
|
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: gbo
|
|
steps:
|
|
- name: Pull Latest
|
|
run: |
|
|
echo "=== Pull Latest ==="
|
|
cd /opt/gbo/work/botserver
|
|
|
|
# Abort any rebase in progress
|
|
git rebase --abort 2>/dev/null || true
|
|
|
|
# Reset to clean state
|
|
git reset --hard HEAD
|
|
git clean -fd
|
|
|
|
# Pull latest (merge, not rebase)
|
|
git pull
|
|
|
|
# Remove .github submodule (causes auth issues)
|
|
rm -rf .github
|
|
grep -v "github" .gitmodules > .gitmodules.tmp || true
|
|
mv .gitmodules.tmp .gitmodules
|
|
|
|
# Initialize only required submodules
|
|
git submodule update --init --recursive botlib botserver
|
|
|
|
- name: Build BotServer Only
|
|
run: |
|
|
echo "=== Build BotServer ==="
|
|
cd /opt/gbo/work/botserver
|
|
cargo build -p botserver
|
|
ls -lh target/debug/botserver
|
|
|
|
- name: Deploy
|
|
run: |
|
|
echo "=== Deploy ==="
|
|
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
|
|
if [ -f "$BINARY" ]; then
|
|
echo "Binary exists: $BINARY"
|
|
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system@localhost \
|
|
"bash -c 'cd /opt/gbo/bin && pkill -f botserver || true; sleep 2'"
|
|
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=10 system@localhost \
|
|
"bash -c 'cp $BINARY /opt/gbo/bin/botserver && systemctl restart botserver'"
|
|
echo "Deploy completed"
|
|
else
|
|
echo "ERROR: Binary not found at $BINARY"
|
|
exit 1
|
|
fi
|