name: Build and Release
on:
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- x86_64-apple-darwin
- x86_64-unknown-freebsd
steps:
- uses: actions/checkout@v3
- name: Install cross
run: cargo install cross
- name: Build
run: cross build --release --target ${{ matrix.target }}
- name: Package
run: |
mkdir artifacts
if [[ "${{ matrix.target }}" == *"windows"* ]]; then
zip artifacts/rprobe-${{ matrix.target }}.zip target/${{ matrix.target }}/release/rprobe.exe
else
tar czf artifacts/rprobe-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release rprobe
- uses: actions/upload-artifact@v3
with:
name: rprobe-${{ matrix.target }}
path: artifacts/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v3
with:
name: '**'
path: artifacts/
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}