generalbots/.forgejo/workflows/botserver-v2.yaml
2026-04-18 20:33:29 -03:00

56 lines
1.7 KiB
YAML

# HASH-BUSTER-20260418-CONTAINER-v20
# Deploy via Incus file copy instead of SSH
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
git rebase --abort 2>/dev/null || true
git reset --hard HEAD
git clean -fd
git pull
rm -rf .github
grep -v "github" .gitmodules > .gitmodules.tmp || true
mv .gitmodules.tmp .gitmodules
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 via Incus
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
if [ -f "$BINARY" ]; then
echo "Binary exists: $BINARY"
# Copy binary to system container via incus
sudo incus file push "$BINARY" system/opt/gbo/bin/botserver --mode=0755
# Restart botserver service
sudo incus exec system -- systemctl restart botserver
echo "✅ Deploy completed successfully!"
echo "Binary timestamp: $(stat -c '%y' /opt/gbo/bin/botserver 2>/dev/null || echo 'N/A')"
else
echo "ERROR: Binary not found at $BINARY"
exit 1
fi