generalbots/.forgejo/workflows/botserver.yaml
Rodrigo Rodriguez (Pragmatismo) 1e96b18c81
Some checks failed
Bottest CI / build (push) Waiting to run
BotUI CI / build (push) Waiting to run
Botlib CI / build (push) Successful in 2s
BotServer CI / build (push) Has been cancelled
fix(ci): build with embed-ui feature instead of syncing files
2026-04-24 01:30:49 +00:00

39 lines
1.8 KiB
YAML

name: BotServer CI
on:
push:
branches: [main]
defaults:
run:
working-directory: /opt/gbo/work/generalbots
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: ${{ vars.SYSTEM_HOST }}
SYSTEM_USER: gbuser
steps:
- name: Prepare workspace
run: |
mkdir -p /opt/gbo/work/generalbots /opt/gbo/work/target /opt/gbo/bin
if [ ! -d /opt/gbo/work/generalbots/.git ]; then
git clone https://alm.pragmatismo.com.br/GeneralBots/generalbots.git /opt/gbo/work/generalbots
fi
cd /opt/gbo/work/generalbots
git reset --hard HEAD
git clean -fd
git pull
git submodule update --init --recursive
- name: Build with embedded UI
run: |
CARGO_BUILD_JOBS=4 cargo build -p botserver --bin botserver --features embed-ui
- 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'"