generalbots/.forgejo/workflows/botserver.yaml

32 lines
1.1 KiB
YAML
Raw Normal View History

name: BotServer CI
on:
push:
branches: [main]
env:
CARGO_TARGET_DIR: /opt/gbo/work/target
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/generalbots
git reset --hard HEAD
git clean -fd
git pull
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
run: |
timeout 5 bash -c 'while pgrep -x botserver > /dev/null; do pkill -x botserver; sleep 0.5; done' || true
cp -f /opt/gbo/work/target/debug/botserver /opt/gbo/bin/
chmod +x /opt/gbo/bin/botserver
cd /opt/gbo/bin && RUST_LOG=info nohup ./botserver --noconsole > /opt/gbo/logs/stdout.log 2> /opt/gbo/logs/stderr.log &
sleep 5
pgrep -x botserver && echo "BotServer Deployed" || echo "Failed"