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

54 lines
1.5 KiB
YAML
Raw Normal View History

# HASH-BUSTER-20260418-CONTAINER-v15
# Dev machine approach: just pull, no clone
# Pre-installed: Rust, Node, Python on runner (ci-alm)
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
jobs:
build:
runs-on: gbo
steps:
- name: Pull Latest
run: |
echo "=== Pull Latest ==="
cd /opt/gbo/data
git pull --rebase
cd /opt/gbo/data/botserver
git pull --rebase
cd /opt/gbo/data/botlib
git pull --rebase
- name: Build
run: |
echo "=== Build ==="
cd /opt/gbo/data/botserver
cargo build -p botserver
ls -lh target/debug/botserver
- name: Deploy
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/data/botserver/target/debug/botserver"
if [ -f "$BINARY" ]; then
echo "Binary exists: $BINARY"
# Copy to system container
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