name: Release
on:
push:
tags: [ "v*" ]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
BIN: llm-token-visualizer
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: windows-latest, target: x86_64-pc-windows-msvc }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
name="$BIN-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir -p "dist/$name"
if [ "${{ runner.os }}" = "Windows" ]; then exe="$BIN.exe"; else exe="$BIN"; fi
cp "target/${{ matrix.target }}/release/$exe" README.md LICENSE "dist/$name/"
cp -r examples/logprobs "dist/$name/samples"
cd dist
if [ "${{ runner.os }}" = "Windows" ]; then 7z a "$name.zip" "$name" >/dev/null; else tar czf "$name.tar.gz" "$name"; fi
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: dist/*.*z*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
path: dist
merge-multiple: true
- name: Checksums
run: cd dist && sha256sum * > SHA256SUMS.txt
- uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true