name: Ammend Release with Binaries (DEB, Windows, MacOS)
on:
release:
types: [created]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: tar.gz
- os: macos-latest
target: x86_64-apple-darwin
ext: tar.gz
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: zip
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package binary
run: |
mkdir dist
if [ "${{ matrix.os }}" = "windows-latest" ]; then
cp target/${{ matrix.target }}/release/thanix.exe dist/
cd dist && zip ../thanix-${{ matrix.target }}.${{ matrix.ext }} thanix.exe
else
cp target/${{ matrix.target }}/release/thanix dist/
cd dist && tar czf ../thanix-${{ matrix.target }}.${{ matrix.ext }} thanix
fi
- name: Build Debian package
if: matrix.os == 'ubuntu-latest'
run: |
cargo install cargo-deb --force
cargo deb --no-build --output ../thanix-${{ matrix.target }}.deb
- name: Upload to GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
thanix-${{ matrix.target }}.${{ matrix.ext }}
thanix-${{ matrix.target }}.deb
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}