releases #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: releases | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: write | |
| env: | |
| GGML_NATIVE: "OFF" | |
| MACOSX_DEPLOYMENT_TARGET: "14.0" | |
| jobs: | |
| check_release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Echo tag | |
| run: | | |
| echo "tag name: ${{ github.event.release.tag_name }}" | |
| echo "release name: ${{ github.event.release.name }}" | |
| build: | |
| needs: check_release | |
| runs-on: ${{ matrix.runner }} | |
| strategy: | |
| matrix: | |
| include: | |
| - { | |
| runner: macos-latest, | |
| osname: macOS, | |
| arch: amd64, | |
| target: x86_64-apple-darwin, | |
| command: build, | |
| } | |
| - { | |
| runner: macos-latest, | |
| osname: macOS, | |
| arch: arm64, | |
| target: aarch64-apple-darwin, | |
| command: build, | |
| build_args: --features metal, | |
| } | |
| - { | |
| runner: ubuntu-latest, | |
| osname: linux, | |
| arch: amd64, | |
| target: x86_64-unknown-linux-gnu, | |
| command: build, | |
| } | |
| - { | |
| runner: ubuntu-latest, | |
| osname: linux, | |
| arch: amd64-noavx, | |
| target: x86_64-unknown-linux-gnu, | |
| command: build, | |
| noavx: true, | |
| } | |
| - { | |
| runner: ubuntu-24.04-arm, | |
| osname: linux, | |
| arch: arm64, | |
| target: aarch64-unknown-linux-gnu, | |
| command: build, | |
| build_args: --no-default-features, | |
| } | |
| - { | |
| runner: windows-latest, | |
| osname: windows, | |
| arch: amd64, | |
| target: x86_64-pc-windows-msvc, | |
| command: build, | |
| extension: ".exe", | |
| } | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Install build dependencies (Linux) | |
| if: matrix.osname == 'linux' | |
| run: sudo apt-get update && sudo apt-get install -y cmake | |
| - name: Get the release version from the tag | |
| shell: bash | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | |
| - name: Disable AVX for baseline build | |
| if: matrix.noavx | |
| shell: bash | |
| run: | | |
| echo "GGML_AVX=OFF" >> $GITHUB_ENV | |
| echo "GGML_AVX2=OFF" >> $GITHUB_ENV | |
| echo "GGML_FMA=OFF" >> $GITHUB_ENV | |
| echo "GGML_F16C=OFF" >> $GITHUB_ENV | |
| - name: Install Rust toolchain (native builds) | |
| if: matrix.runner == 'ubuntu-24.04-arm' | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build binary (native) | |
| if: matrix.runner == 'ubuntu-24.04-arm' | |
| run: cargo build --bin dria-node --locked --release --target ${{ matrix.target }} ${{ matrix.build_args }} | |
| - name: Strip binary (native) | |
| if: matrix.runner == 'ubuntu-24.04-arm' | |
| run: strip target/${{ matrix.target }}/release/dria-node | |
| - name: Build binary (cross) | |
| if: matrix.runner != 'ubuntu-24.04-arm' | |
| uses: houseabsolute/actions-rust-cross@v0 | |
| with: | |
| command: ${{ matrix.command }} | |
| target: ${{ matrix.target }} | |
| args: "--bin dria-node --locked --release ${{ matrix.build_args }}" | |
| strip: true | |
| - name: Prepare Release File | |
| run: | | |
| mv target/${{ matrix.target }}/release/dria-node${{ matrix.extension }} ./dria-node-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} | |
| - name: Upload Launch Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dria-node-${{ matrix.osname }}-${{ matrix.arch }} | |
| path: dria-node-${{ matrix.osname }}-${{ matrix.arch }}${{ matrix.extension }} | |
| release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Launch Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: ./artifacts | |
| - name: Create release with artifacts | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| name: ${{ github.event.release.name }} | |
| tag: ${{ github.event.release.tag_name }} | |
| artifacts: "artifacts/*" | |
| artifactContentType: application/octet-stream | |
| allowUpdates: true | |
| makeLatest: false | |
| update_homebrew: | |
| needs: release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: ./artifacts | |
| - name: Checkout homebrew tap | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: firstbatchxyz/homebrew-dkn | |
| token: ${{ secrets.HOMEBREW_TAP_TOKEN }} | |
| path: homebrew-dkn | |
| - name: Update formula | |
| run: | | |
| VERSION="${{ github.event.release.tag_name }}" | |
| VERSION="${VERSION#v}" | |
| SHA_MACOS_AMD64=$(sha256sum artifacts/dria-node-macOS-amd64 | cut -d' ' -f1) | |
| SHA_MACOS_ARM64=$(sha256sum artifacts/dria-node-macOS-arm64 | cut -d' ' -f1) | |
| SHA_LINUX_AMD64=$(sha256sum artifacts/dria-node-linux-amd64 | cut -d' ' -f1) | |
| SHA_LINUX_ARM64=$(sha256sum artifacts/dria-node-linux-arm64 | cut -d' ' -f1) | |
| FORMULA=homebrew-dkn/Formula/dria-node.rb | |
| cat > "$FORMULA" << 'RUBY' | |
| class DriaNode < Formula | |
| desc "Dria Compute Node - run AI inference on the Dria network" | |
| homepage "https://github.com/firstbatchxyz/dkn-compute-node" | |
| version "VERSION_PLACEHOLDER" | |
| license "Apache-2.0" | |
| on_macos do | |
| on_intel do | |
| url "https://github.com/firstbatchxyz/dkn-compute-node/releases/download/vVERSION_PLACEHOLDER/dria-node-macOS-amd64" | |
| sha256 "SHA_MACOS_AMD64_PLACEHOLDER" | |
| end | |
| on_arm do | |
| url "https://github.com/firstbatchxyz/dkn-compute-node/releases/download/vVERSION_PLACEHOLDER/dria-node-macOS-arm64" | |
| sha256 "SHA_MACOS_ARM64_PLACEHOLDER" | |
| end | |
| end | |
| on_linux do | |
| on_intel do | |
| url "https://github.com/firstbatchxyz/dkn-compute-node/releases/download/vVERSION_PLACEHOLDER/dria-node-linux-amd64" | |
| sha256 "SHA_LINUX_AMD64_PLACEHOLDER" | |
| end | |
| on_arm do | |
| url "https://github.com/firstbatchxyz/dkn-compute-node/releases/download/vVERSION_PLACEHOLDER/dria-node-linux-arm64" | |
| sha256 "SHA_LINUX_ARM64_PLACEHOLDER" | |
| end | |
| end | |
| def install | |
| binary = Dir.glob("dria-node*").first | |
| bin.install binary => "dria-node" | |
| end | |
| test do | |
| assert_match "dria-node", shell_output("#{bin}/dria-node --version") | |
| end | |
| end | |
| RUBY | |
| # Remove leading whitespace from heredoc | |
| sed -i 's/^ //' "$FORMULA" | |
| # Replace placeholders with actual values | |
| sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" "$FORMULA" | |
| sed -i "s/SHA_MACOS_AMD64_PLACEHOLDER/${SHA_MACOS_AMD64}/g" "$FORMULA" | |
| sed -i "s/SHA_MACOS_ARM64_PLACEHOLDER/${SHA_MACOS_ARM64}/g" "$FORMULA" | |
| sed -i "s/SHA_LINUX_AMD64_PLACEHOLDER/${SHA_LINUX_AMD64}/g" "$FORMULA" | |
| sed -i "s/SHA_LINUX_ARM64_PLACEHOLDER/${SHA_LINUX_ARM64}/g" "$FORMULA" | |
| - name: Commit and push | |
| run: | | |
| cd homebrew-dkn | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/dria-node.rb | |
| git commit -m "Update dria-node to ${{ github.event.release.tag_name }}" | |
| git push |