name: Release
on:
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CARGO_TERM_COLOR: always
permissions:
contents: write
jobs:
release:
name: Release
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- build: freebsd
os: ubuntu-latest
target: x86_64-unknown-freebsd
- build: windows
os: windows-2025
target: x86_64-pc-windows-msvc
rustflags: "-C link-arg=advapi32.lib"
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install libudev-dev (Linux)
if: matrix.build == 'linux'
run: sudo apt-get update && sudo apt-get install -y libudev-dev
- name: Build FreeBSD
if: matrix.build == 'freebsd'
uses: vmactions/freebsd-vm@v1
with:
release: "15.0"
arch: x86_64
mem: 8192
sync: rsync
prepare: |
pkg install -y rust hidapi pkgconf
run: |
cargo build --release --locked
cp target/release/framework-tool-tui framework-tool-tui-freebsd
- uses: moonrepo/setup-rust@v1
if: matrix.build != 'freebsd'
with:
targets: ${{ matrix.target }}
- name: Build
if: matrix.build != 'freebsd'
run: cargo build --release --locked --target ${{ matrix.target }}
env:
RUSTFLAGS: ${{ matrix.rustflags }}
- name: Build archive
shell: bash
run: |
binary_name="framework-tool-tui"
dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}"
mkdir "$dirname"
if [ "${{ matrix.build }}" = "freebsd" ]; then
mv "$binary_name-freebsd" "$dirname/$binary_name"
elif [ "${{ matrix.build }}" = "windows" ]; then
mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname"
else
mv "target/${{ matrix.target }}/release/$binary_name" "$dirname"
fi
if [ "${{ matrix.build }}" = "windows" ]; then
7z a "$dirname.zip" "$dirname"
echo "ASSET=$dirname.zip" >> $GITHUB_ENV
else
tar -czf "$dirname.tar.gz" "$dirname"
echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v3
with:
files: |
${{ env.ASSET }}