fix: include deno and uv tools in binary bundle #38
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build zoo-node binaries | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| jobs: | |
| build-binaries: | |
| name: Build binary | |
| permissions: | |
| contents: write | |
| strategy: | |
| matrix: | |
| include: | |
| - arch: x86_64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| - arch: aarch64-apple-darwin | |
| os: macos-14 | |
| - arch: x86_64-pc-windows-msvc | |
| os: windows-2022 | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v4 | |
| - name: Download tools from store to pre-install folder | |
| run: | | |
| ./scripts/update_tools.sh | |
| - name: Configure rust-lld linker for Windows | |
| if: matrix.os == 'windows-2022' | |
| run: | | |
| if (-Not (Test-Path ".cargo")) { mkdir .cargo } | |
| echo '[target.x86_64-pc-windows-msvc]' > .cargo/config.toml | |
| echo 'linker = "rust-lld"' >> .cargo/config.toml | |
| - name: Install protobuf compiler (Linux) | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Install protobuf compiler (macOS) | |
| if: matrix.os == 'macos-14' | |
| run: brew install protobuf | |
| - name: Cache cargo assets | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ matrix.arch }}-build-cargo-v1 | |
| restore-keys: | | |
| ${{ matrix.arch }}-build-cargo- | |
| - name: Build | |
| env: | |
| GLOBAL_IDENTITY_NAME: "@@localhost.sep-zoo" | |
| run: cargo build --release --bin zoo-node | |
| - name: Prepare bundle files | |
| shell: bash | |
| env: | |
| ZIP_FILE_NAME: ${{ github.ref_name }}.zip | |
| EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | |
| run: | | |
| mkdir -p files-to-r2/zoo-tools-runner-resources | |
| cp target/release/zoo-node${{ env.EXTENSION }} files-to-r2/zoo-node${{ env.EXTENSION }} | |
| # Copy tools from pre-install folder (deno, uv) | |
| if [ -d "pre-install" ]; then | |
| find pre-install -name "deno*" -type f -exec cp {} files-to-r2/zoo-tools-runner-resources/deno${{ env.EXTENSION }} \; 2>/dev/null || true | |
| find pre-install -name "uv*" -type f -not -name "*.zip" -exec cp {} files-to-r2/zoo-tools-runner-resources/uv${{ env.EXTENSION }} \; 2>/dev/null || true | |
| fi | |
| # Legacy support: copy if exists in build output | |
| if [ -d "target/release/shinkai-tools-runner-resources" ]; then | |
| cp -r target/release/shinkai-tools-runner-resources/* files-to-r2/zoo-tools-runner-resources/ 2>/dev/null || true | |
| fi | |
| cd ./files-to-r2 | |
| 7z a -tzip ${{ env.ZIP_FILE_NAME}} . -sdel | |
| cp ${{ env.ZIP_FILE_NAME}} latest.zip | |
| - name: Upload bundle to R2 bucket | |
| continue-on-error: true | |
| uses: shallwefootball/s3-upload-action@master | |
| with: | |
| endpoint: https://94a3e3f299092abb1feda2a7481ea845.r2.cloudflarestorage.com | |
| aws_key_id: ${{ secrets.R2_ACCESS_KEY_ID }} | |
| aws_secret_access_key: ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
| aws_bucket: zooai | |
| source_dir: files-to-r2 | |
| destination_dir: ./zoo-node/binaries/production/${{ matrix.arch }}/ | |
| - name: Upload bundle to release | |
| uses: svenstaro/upload-release-action@v2 | |
| env: | |
| EXTENSION: ${{ matrix.arch == 'x86_64-pc-windows-msvc' && '.exe' || '' }} | |
| with: | |
| repo_token: ${{ secrets.GITHUB_TOKEN }} | |
| file: files-to-r2/${{ github.ref_name }}.zip | |
| asset_name: zoo-node-${{ matrix.arch }}.zip | |
| tag: ${{ github.ref }} | |
| overwrite: true | |
| build-docker-image: | |
| name: Build and push Docker image to Docker Hub | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Download tools from store to pre-install folder | |
| run: | | |
| ./scripts/update_tools.sh | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./docker/Dockerfile | |
| push: true | |
| build-args: | | |
| BUILD_TYPE=release | |
| GLOBAL_IDENTITY_NAME=@@localhost.sep-zoo | |
| tags: | | |
| zooai/zoo-node:${{ github.ref_name }} | |
| zooai/zoo-node:release-latest |