name: GBCI Bundle on: push: branches: ["main"] tags: ["v*"] pull_request: branches: ["main"] workflow_dispatch: jobs: build-bundle: runs-on: gbo steps: - name: Disable SSL verification (temporary) run: git config --global http.sslVerify false - uses: actions/checkout@v4 - name: Clone dependencies run: | git clone --depth 1 https://github.com/GeneralBots/botlib.git ../botlib git clone --depth 1 https://github.com/GeneralBots/botui.git ../botui git clone --depth 1 https://github.com/GeneralBots/botbook.git ../botbook git clone --depth 1 https://github.com/GeneralBots/botmodels.git ../botmodels - name: Cache Cargo registry uses: actions/cache@v4 with: path: | ~/.cargo/registry ~/.cargo/git target key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }} restore-keys: | ${{ runner.os }}-cargo-bundle- - name: Install Rust uses: msrd0/rust-toolchain@v1 with: toolchain: stable targets: >- x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-gnu, x86_64-apple-darwin, aarch64-apple-darwin - name: Install cross-compilation dependencies run: | sudo apt-get update sudo apt-get install -y \ gcc-mingw-w64-x86-64 \ gcc-aarch64-linux-gnu \ libc6-dev-arm64-cross \ zip - name: Setup environment run: sudo cp /opt/gbo/bin/system/.env . # ============================================ # Download Python portable distributions # ============================================ - name: Download Python portables run: | PYTHON_VERSION="3.12.7" mkdir -p python-installers # Linux x86_64 - python-build-standalone curl -L -o python-installers/python-${PYTHON_VERSION}-linux-x86_64.tar.gz \ "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-unknown-linux-gnu-install_only.tar.gz" # Linux ARM64 - python-build-standalone curl -L -o python-installers/python-${PYTHON_VERSION}-linux-arm64.tar.gz \ "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-aarch64-unknown-linux-gnu-install_only.tar.gz" # Windows x86_64 - python-build-standalone curl -L -o python-installers/python-${PYTHON_VERSION}-windows-x86_64.tar.gz \ "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-pc-windows-msvc-install_only.tar.gz" # macOS x86_64 - python-build-standalone curl -L -o python-installers/python-${PYTHON_VERSION}-macos-x86_64.tar.gz \ "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-x86_64-apple-darwin-install_only.tar.gz" # macOS ARM64 - python-build-standalone curl -L -o python-installers/python-${PYTHON_VERSION}-macos-arm64.tar.gz \ "https://github.com/indygreg/python-build-standalone/releases/download/20241016/cpython-${PYTHON_VERSION}+20241016-aarch64-apple-darwin-install_only.tar.gz" ls -la python-installers/ # ============================================ # Build botserver for all platforms # ============================================ - name: Build botserver - Linux x86_64 run: cargo build --release --locked --target x86_64-unknown-linux-gnu - name: Build botserver - Linux ARM64 env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc run: cargo build --release --locked --target aarch64-unknown-linux-gnu - name: Build botserver - Windows x86_64 env: CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc run: cargo build --release --locked --target x86_64-pc-windows-gnu - name: Build botserver - macOS x86_64 run: cargo build --release --locked --target x86_64-apple-darwin || echo "macOS x86_64 requires osxcross" - name: Build botserver - macOS ARM64 run: cargo build --release --locked --target aarch64-apple-darwin || echo "macOS ARM64 requires osxcross" # ============================================ # Build botui for all platforms # ============================================ - name: Build botui - Linux x86_64 run: | cd ../botui cargo build --release --locked --target x86_64-unknown-linux-gnu - name: Build botui - Linux ARM64 env: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc run: | cd ../botui cargo build --release --locked --target aarch64-unknown-linux-gnu - name: Build botui - Windows x86_64 env: CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc run: | cd ../botui cargo build --release --locked --target x86_64-pc-windows-gnu - name: Build botui - macOS x86_64 run: | cd ../botui cargo build --release --locked --target x86_64-apple-darwin || echo "macOS x86_64 requires osxcross" - name: Build botui - macOS ARM64 run: | cd ../botui cargo build --release --locked --target aarch64-apple-darwin || echo "macOS ARM64 requires osxcross" # ============================================ # Build botbook documentation # ============================================ - name: Install mdBook run: | if ! command -v mdbook &> /dev/null; then cargo install mdbook fi - name: Build botbook run: | cd ../botbook mdbook build # ============================================ # Create bundle directories # Structure: # botserver(.exe) <- root binary # botserver-components/ # botui(.exe) # botmodels/ # botbook/ # botserver-installers/ # python--.tar.gz # postgresql, valkey, vault, minio, zitadel, llama, models... # ============================================ - name: Create bundle structure run: | BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') PYTHON_VERSION="3.12.7" # Linux x86_64 bundle mkdir -p bundle/linux-x86_64/botserver-components mkdir -p bundle/linux-x86_64/botserver-installers cp ./target/x86_64-unknown-linux-gnu/release/gbserver bundle/linux-x86_64/botserver || true cp ../botui/target/x86_64-unknown-linux-gnu/release/botui bundle/linux-x86_64/botserver-components/ || true cp python-installers/python-${PYTHON_VERSION}-linux-x86_64.tar.gz bundle/linux-x86_64/botserver-installers/ # Linux ARM64 bundle mkdir -p bundle/linux-arm64/botserver-components mkdir -p bundle/linux-arm64/botserver-installers cp ./target/aarch64-unknown-linux-gnu/release/gbserver bundle/linux-arm64/botserver || true cp ../botui/target/aarch64-unknown-linux-gnu/release/botui bundle/linux-arm64/botserver-components/ || true cp python-installers/python-${PYTHON_VERSION}-linux-arm64.tar.gz bundle/linux-arm64/botserver-installers/ # Windows x86_64 bundle mkdir -p bundle/windows-x86_64/botserver-components mkdir -p bundle/windows-x86_64/botserver-installers cp ./target/x86_64-pc-windows-gnu/release/gbserver.exe bundle/windows-x86_64/botserver.exe || true cp ../botui/target/x86_64-pc-windows-gnu/release/botui.exe bundle/windows-x86_64/botserver-components/ || true cp python-installers/python-${PYTHON_VERSION}-windows-x86_64.tar.gz bundle/windows-x86_64/botserver-installers/ # macOS x86_64 bundle mkdir -p bundle/macos-x86_64/botserver-components mkdir -p bundle/macos-x86_64/botserver-installers cp ./target/x86_64-apple-darwin/release/gbserver bundle/macos-x86_64/botserver || true cp ../botui/target/x86_64-apple-darwin/release/botui bundle/macos-x86_64/botserver-components/ || true cp python-installers/python-${PYTHON_VERSION}-macos-x86_64.tar.gz bundle/macos-x86_64/botserver-installers/ # macOS ARM64 bundle mkdir -p bundle/macos-arm64/botserver-components mkdir -p bundle/macos-arm64/botserver-installers cp ./target/aarch64-apple-darwin/release/gbserver bundle/macos-arm64/botserver || true cp ../botui/target/aarch64-apple-darwin/release/botui bundle/macos-arm64/botserver-components/ || true cp python-installers/python-${PYTHON_VERSION}-macos-arm64.tar.gz bundle/macos-arm64/botserver-installers/ # ============================================ # Copy shared components to all bundles # ============================================ - name: Copy botmodels to bundles run: | for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do mkdir -p bundle/$platform/botserver-components/botmodels cp -r ../botmodels/* bundle/$platform/botserver-components/botmodels/ done - name: Copy botbook to bundles run: | for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do mkdir -p bundle/$platform/botserver-components/botbook cp -r ../botbook/book/* bundle/$platform/botserver-components/botbook/ done - name: Copy installers to bundles run: | for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do cp -r ./botserver-installers/* bundle/$platform/botserver-installers/ done # ============================================ # Create ZIP archives # ============================================ - name: Create release archives run: | BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') cd bundle for platform in linux-x86_64 linux-arm64 windows-x86_64 macos-x86_64 macos-arm64; do if [ -f "$platform/botserver" ] || [ -f "$platform/botserver.exe" ]; then zip -r "botserver-bundle-${BUNDLE_VERSION}-${platform}.zip" "$platform" echo "Created: botserver-bundle-${BUNDLE_VERSION}-${platform}.zip" fi done cd .. # ============================================ # Deploy bundles # ============================================ - name: Deploy bundle releases run: | BUNDLE_VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') sudo mkdir -p /opt/gbo/releases/botserver-bundle sudo cp bundle/*.zip /opt/gbo/releases/botserver-bundle/ || true # Also keep unpacked bundles for direct access sudo mkdir -p /opt/gbo/releases/botserver-bundle/unpacked sudo cp -r bundle/linux-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true sudo cp -r bundle/linux-arm64 /opt/gbo/releases/botserver-bundle/unpacked/ || true sudo cp -r bundle/windows-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true sudo cp -r bundle/macos-x86_64 /opt/gbo/releases/botserver-bundle/unpacked/ || true sudo cp -r bundle/macos-arm64 /opt/gbo/releases/botserver-bundle/unpacked/ || true sudo chmod -R 755 /opt/gbo/releases/botserver-bundle/ echo "Bundle releases deployed to /opt/gbo/releases/botserver-bundle/" ls -la /opt/gbo/releases/botserver-bundle/