name: Release
on:
push:
tags:
- "v*"
jobs:
build:
name: Build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
archive: tar.gz
- os: macos-15-intel
target: x86_64-apple-darwin
archive: tar.gz
- os: macos-15
target: aarch64-apple-darwin
archive: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
steps:
- uses: actions/checkout@v5
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Build release binary
run: cargo build --locked --release
- name: Package archive (Unix)
if: runner.os != 'Windows'
shell: bash
run: |
mkdir -p dist
cp target/release/stprobe dist/stprobe
tar -czf "stprobe-${{ matrix.target }}.tar.gz" -C dist stprobe
- name: Package archive (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force -Path dist | Out-Null
Copy-Item "target/release/stprobe.exe" "dist/stprobe.exe"
Compress-Archive -Path "dist/stprobe.exe" -DestinationPath "stprobe-${{ matrix.target }}.zip" -Force
- name: Upload packaged binary
uses: actions/upload-artifact@v6
with:
name: release-${{ matrix.target }}
path: stprobe-${{ matrix.target }}.${{ matrix.archive }}
publish:
name: Publish release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download packaged binaries
uses: actions/download-artifact@v5
with:
pattern: release-*
path: dist
merge-multiple: true
- name: Upload release assets
uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true