generalbots/.forgejo/workflows/botserver-v2.yaml

64 lines
1.9 KiB
YAML
Raw Normal View History

# HASH-BUSTER-20260418-CONTAINER-v21
# Force clean git state before build
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: Force Clean Git State
run: |
echo "=== Force Clean Git State ==="
cd /opt/gbo/work/botserver
# Abort ANY git operation (rebase, merge, etc)
git rebase --abort 2>/dev/null || true
git merge --abort 2>/dev/null || true
git cherry-pick --abort 2>/dev/null || true
# Reset to HEAD
git reset --hard HEAD
git clean -fd
# Pull fresh
git fetch origin main
git checkout main
git reset --hard origin/main
# Remove problematic submodules
rm -rf .github
grep -v "github" .gitmodules > .gitmodules.tmp 2>/dev/null || true
mv .gitmodules.tmp .gitmodules 2>/dev/null || true
# Init only required submodules
git submodule update --init --recursive botlib botserver
echo "Git state: $(git status --short | wc -l) changes"
- name: Build BotServer Only
run: |
echo "=== Build BotServer ==="
cd /opt/gbo/work/botserver
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy via Incus
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
if [ -f "$BINARY" ]; then
echo "Binary exists: $BINARY"
sudo incus file push "$BINARY" system:/opt/gbo/bin/botserver --mode=0755
sudo incus exec system -- systemctl restart botserver
echo "✅ Deploy completed!"
else
echo "ERROR: Binary not found"
exit 1
fi