botserver/.forgejo/workflows/botserver.yaml

58 lines
1.6 KiB
YAML
Raw Normal View History

name: GBCI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build:
runs-on: gbo
steps:
- name: Disable SSL verification (temporary)
run: git config --global http.sslVerify false
- uses: actions/checkout@v4
- name: Clone botlib dependency
run: git clone --depth 1 https://github.com/GeneralBots/botlib.git ../botlib
2025-12-16 16:35:22 -03:00
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-botserver-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-botserver-
- name: Install Rust
run: |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
echo "/root/.cargo/bin" >> $GITHUB_PATH
- name: Setup environment
run: sudo cp /opt/gbo/bin/system/.env .
- name: Build Linux x86_64
run: /root/.cargo/bin/cargo build --release --locked
- name: Prepare release artifacts
run: |
sudo mkdir -p /opt/gbo/releases/botserver/linux
sudo cp ./target/release/botserver /opt/gbo/releases/botserver/linux/botserver-x86_64 || true
sudo chmod -R 755 /opt/gbo/releases/botserver/
- name: Deploy to production and restart
run: |
lxc exec bot:pragmatismo-system -- systemctl stop system
sudo cp ./target/release/botserver /opt/gbo/bin/system/botserver
sudo chmod +x /opt/gbo/bin/system/botserver
lxc exec bot:pragmatismo-system -- systemctl start system