generalbots/.forgejo/workflows/botserver.yaml
Rodrigo Rodriguez (Pragmatismo) 984ee848d3
Some checks failed
Botlib CI / build (push) Waiting to run
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
BotServer CI / build (push) Has been cancelled
Fix: Hardcode SYSTEM_HOST for deploy to work
- Temporary fix: Hardcoded SYSTEM_HOST to 10.157.134.196
- Issue: Repository variables not being resolved in workflow
- Next: Test deploy works, then fix variable system
2026-04-28 11:21:48 -03:00

41 lines
1.6 KiB
YAML

name: BotServer CI
on:
push:
branches: [main]
paths:
- "botserver/**"
- "botlib/**"
- ".forgejo/workflows/botserver.yaml"
- "Cargo.toml"
- "Cargo.lock"
jobs:
build:
runs-on: gbo
env:
CARGO_TARGET_DIR: /opt/gbo/work/target
RUSTC_WRAPPER: ""
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SYSTEM_HOST: "10.157.134.196"
SYSTEM_USER: gbuser
steps:
- name: Setup
run: |
cd /opt/gbo/work/generalbots
git reset --hard HEAD
git clean -fd
git pull
git submodule update --init --recursive
mkdir -p /opt/gbo/work/target
mkdir -p /opt/gbo/bin
- name: Build
run: |
cd /opt/gbo/work/generalbots
CARGO_BUILD_JOBS=4 cargo build -p botserver --bin botserver
- name: Deploy to Stage
run: |
BINARY=/opt/gbo/work/target/debug/botserver
ssh -o StrictHostKeyChecking=no ${SYSTEM_USER}@${SYSTEM_HOST} "sudo systemctl stop botserver 2>/dev/null; sudo pkill -x botserver 2>/dev/null; sleep 1"
scp -o StrictHostKeyChecking=no "$BINARY" ${SYSTEM_USER}@${SYSTEM_HOST}:/opt/gbo/bin/botserver-new
ssh -o StrictHostKeyChecking=no ${SYSTEM_USER}@${SYSTEM_HOST} "sudo mv /opt/gbo/bin/botserver-new /opt/gbo/bin/botserver && sudo chmod +x /opt/gbo/bin/botserver && sudo systemctl enable botserver && sudo systemctl start botserver"
sleep 10
ssh -o StrictHostKeyChecking=no ${SYSTEM_USER}@${SYSTEM_HOST} "curl -sf http://localhost:8080/health && echo 'BotServer Deployed' || echo 'Failed'"