name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
build-linux:
name: Build Linux (musl)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y musl-tools protobuf-compiler
- name: Build
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Package
run: |
tar czf ulm-${{ github.ref_name }}-x86_64-linux-musl.tar.gz -C target/x86_64-unknown-linux-musl/release ulm
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ulm-x86_64-linux-musl
path: ulm-${{ github.ref_name }}-x86_64-linux-musl.tar.gz
build-macos:
name: Build macOS ${{ matrix.arch }}
runs-on: macos-latest
strategy:
matrix:
include:
- target: x86_64-apple-darwin
arch: x86_64
- target: aarch64-apple-darwin
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Install protoc
run: brew install protobuf
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
run: |
tar czf ulm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release ulm
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ulm-${{ matrix.target }}
path: ulm-${{ github.ref_name }}-${{ matrix.target }}.tar.gz
release:
name: Create Release
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/**/*.tar.gz
generate_release_notes: true