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

61 lines
1.7 KiB
YAML
Raw Normal View History

# HASH-BUSTER-20260418-CONTAINER-v15
# Dev machine approach: work folder is /opt/gbo/work/
# Pre-installed: Rust, Node, Python, sccache on runner
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/work
if [ ! -d "gb" ]; then
git clone https://alm.pragmatismo.com.br/GeneralBots/gb.git
fi
cd /opt/gbo/work/gb
git pull --rebase
cd /opt/gbo/work/gb/botserver
git pull --rebase
cd /opt/gbo/work/gb/botlib
git pull --rebase
- name: Build
run: |
echo "=== Build ==="
cd /opt/gbo/work/gb
cargo build -p botserver
cargo build -p botui
cargo build -p botlib
ls -lh target/debug/botserver
ls -lh target/debug/botui
- name: Deploy
run: |
echo "=== Deploy ==="
BINARY="/opt/gbo/work/gb/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