name: Release Binaries
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: rustdu-linux-x86_64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: rustdu-windows-x86_64.exe
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: rustdu-macos-x86_64
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Rename binary
shell: bash
run: |
if [ "${{ matrix.os }}" = "windows-latest" ]; then
mv target/${{ matrix.target }}/release/rustdu.exe target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
else
mv target/${{ matrix.target }}/release/rustdu target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
fi
- name: Upload Artifacts to Release
uses: softprops/action-gh-release@v2
with:
files: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}