Release Dash Evo Tool #24
This file contains 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 and Release Dash Evo Tool | |
on: | |
push: | |
tags: | |
- 'v*' | |
- 'v*-dev.*' | |
release: | |
types: | |
- published | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Version (i.e. v0.1.0)" | |
required: true | |
jobs: | |
build-and-release: | |
name: Build and Release Dash Evo Tool | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest] | |
arch: [amd64, arm64] | |
include: | |
- platform: linux/amd64 | |
os: ubuntu-latest | |
arch: amd64 | |
target: x86_64-unknown-linux-gnu | |
- platform: linux/arm64 | |
os: ubuntu-latest | |
arch: arm64 | |
target: aarch64-unknown-linux-gnu | |
- platform: macos/amd64 | |
os: macos-latest | |
arch: amd64 | |
target: x86_64-apple-darwin | |
- platform: macos/arm64 | |
os: macos-latest | |
arch: arm64 | |
target: aarch64-apple-darwin | |
steps: | |
- uses: actions/checkout@v4 | |
# Linux ARM64 build in Docker | |
- name: Build in ARM64 Docker container (Linux) | |
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64' | |
run: | | |
docker run --platform linux/arm64 --rm -v $(pwd):/build -w /build arm64v8/ubuntu:latest /bin/bash -c " | |
apt-get update && | |
apt-get install -y build-essential gcc-aarch64-linux-gnu libssl-dev curl unzip && | |
# Install protoc for ARM64 | |
curl -Lo /tmp/protoc.zip \ | |
https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-aarch64.zip && | |
unzip /tmp/protoc.zip -d \$HOME/.local && | |
export PATH=\$PATH:\$HOME/.local/bin && | |
# Install Rust and cross-compilation toolchain | |
curl https://sh.rustup.rs -sSf | sh -s -- -y && | |
source \$HOME/.cargo/env && | |
rustup target add aarch64-unknown-linux-gnu && | |
# Build the Rust project | |
cargo build --release --target aarch64-unknown-linux-gnu | |
" | |
# Native Linux amd64 build | |
- name: Build for amd64 (Linux) | |
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'amd64' | |
run: | | |
apt-get update && | |
apt-get install -y libssl-dev curl unzip && | |
# Install protoc | |
curl -Lo /tmp/protoc.zip \ | |
https://github.com/protocolbuffers/protobuf/releases/download/v25.2/protoc-25.2-linux-x86_64.zip && | |
unzip /tmp/protoc.zip -d ${HOME}/.local && | |
export PATH=${PATH}:${HOME}/.local/bin && | |
# Install Rust and build natively for amd64 | |
curl https://sh.rustup.rs -sSf | sh -s -- -y && | |
source $HOME/.cargo/env && | |
rustup target add x86_64-unknown-linux-gnu && | |
cargo build --release --target x86_64-unknown-linux-gnu | |
# macOS build (amd64 or arm64) | |
- name: Build for macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
# Install Rust and protoc for macOS | |
brew install protobuf openssl && | |
# Install Rust and the correct target | |
curl https://sh.rustup.rs -sSf | sh -s -- -y && | |
source $HOME/.cargo/env && | |
rustup target add ${{ matrix.target }} && | |
# Build the project | |
cargo build --release --target ${{ matrix.target }} | |
# Upload artifacts | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: dash-evo-tool-${{ matrix.platform }} | |
path: target/${{ matrix.target }}/release/dash-evo-tool |