gb/.forgejo/workflows/botserver.yaml

34 lines
1.1 KiB
YAML

name: BotServer CI
on:
push:
branches: [main]
env:
PATH: /home/gbuser/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
jobs:
build:
runs-on: system # Run on system container instead of alm-ci
steps:
- name: Setup
run: |
cd /opt/gbo/work/botserver
git rebase --abort 2>/dev/null || true
git reset --hard HEAD && git clean -fd && git pull
git submodule foreach --recursive git reset --hard HEAD 2>/dev/null || true
git submodule update --init --recursive botlib botserver 2>/dev/null || true
- name: Build
run: |
cd /opt/gbo/work/botserver
cargo build -p botserver
- name: Deploy
run: |
echo "Stop..."
systemctl stop botserver || true
pkill -x botserver || true
sleep 1
echo "Copy..."
cp -f /opt/gbo/work/botserver/target/debug/botserver /opt/gbo/bin/botserver
chmod +x /opt/gbo/bin/botserver
echo "Start..."
systemctl start botserver
sleep 2
pgrep -x botserver && echo "✅ Deployed!" || echo "❌ Failed"