gb/.forgejo/workflows/ci.yaml

44 lines
1.3 KiB
YAML

name: BotServer CI
on:
push:
branches: [main]
env:
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs:
build:
runs-on: gbo
steps:
- name: Setup
run: |
cd /opt/gbo/work/botserver
git rebase --abort 2>/dev/null || true
git reset --hard HEAD && git clean -fd
git pull
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
git submodule update --init --recursive botlib botserver 2>/dev/null || true
- name: Build
run: |
cd /opt/gbo/work/botserver
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy
run: |
BINARY="/opt/gbo/work/botserver/target/debug/botserver"
echo "Deploying from: $BINARY"
# Push binary to system container
sudo incus file push "$BINARY" system:/opt/gbo/bin/botserver --mode=0755
echo "✅ Copied to system container"
# Restart botserver on system container
sudo incus exec system -- systemctl restart botserver
echo "✅ Restarted on system"
# Verify
sleep 2
sudo incus exec system -- pgrep -x botserver && echo "✅ Running on system!" || echo "❌ Not running"