name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
create-release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
version: ${{ steps.get_version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get version
id: get_version
run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
## LLM Client ${{ steps.get_version.outputs.version }}
### Installation
**Recommended (All Platforms)**:
```bash
cargo install lc-cli
```
**macOS (Homebrew)** - Coming Soon:
```bash
brew install lc
```
**Windows (Scoop)** - Coming Soon:
```bash
scoop install lc
```
**Direct Download**:
Download the appropriate binary below and add to your PATH.
### System Requirements (Building from Source)
- **Linux**: `sudo apt install -y pkg-config libssl-dev build-essential`
- **macOS**: `xcode-select --install`
- **Windows**: Visual Studio Build Tools with C++ support
### Changelog
See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details.
draft: false
prerelease: false
build-and-upload:
name: Build and Upload
needs: create-release
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: lc
asset_name: lc-linux-x86_64
- os: ubuntu-22.04
target: aarch64-unknown-linux-gnu
artifact_name: lc
asset_name: lc-linux-arm64
use_cross: true
- os: macos-13
target: x86_64-apple-darwin
artifact_name: lc
asset_name: lc-macos-x86_64
- os: macos-14
target: aarch64-apple-darwin
artifact_name: lc
asset_name: lc-macos-arm64
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: lc.exe
asset_name: lc-windows-amd64.exe
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev build-essential
- name: Install macOS system dependencies
if: runner.os == 'macOS'
run: |
# Install Xcode Command Line Tools if not already installed
if ! xcode-select -p &>/dev/null; then
xcode-select --install
fi
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
key: ${{ runner.os }}-cargo-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-${{ matrix.target }}-
${{ runner.os }}-cargo-
- name: Cache target directory
uses: actions/cache@v3
with:
path: target
key: ${{ runner.os }}-target-${{ matrix.target }}-release-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-target-${{ matrix.target }}-release-
${{ runner.os }}-target-${{ matrix.target }}-
- name: Install cross
if: matrix.use_cross
run: |
# Install cross-rs for cross-compilation
cargo install cross --git https://github.com/cross-rs/cross
- name: Verify system dependencies (Linux native build)
if: runner.os == 'Linux' && !matrix.use_cross
run: |
pkg-config --version
pkg-config --exists openssl && echo "OpenSSL found via pkg-config"
pkg-config --libs --cflags openssl
- name: Build (native)
if: ${{ !matrix.use_cross && matrix.os != 'windows-latest' }}
run: cargo build --release --target ${{ matrix.target }}
- name: Build Windows (without S3 to avoid AWS LC issues)
if: matrix.os == 'windows-latest'
run: cargo build --release --target ${{ matrix.target }} --no-default-features --features "pdf unix-sockets"
- name: Build (cross)
if: matrix.use_cross
run: |
# Use cross for cross-compilation which handles OpenSSL in Docker container
cross build --release --target ${{ matrix.target }}
- name: Create tarball (Unix)
if: runner.os != 'Windows'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
cd ../../../
- name: Create zip (Windows)
if: runner.os == 'Windows'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../${{ matrix.asset_name }}.zip ${{ matrix.artifact_name }}
cd ../../../
- name: Upload Release Asset (Unix)
if: runner.os != 'Windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./${{ matrix.asset_name }}.tar.gz
asset_name: ${{ matrix.asset_name }}.tar.gz
asset_content_type: application/gzip
- name: Upload Release Asset (Windows)
if: runner.os == 'Windows'
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create-release.outputs.upload_url }}
asset_path: ./${{ matrix.asset_name }}.zip
asset_name: ${{ matrix.asset_name }}.zip
asset_content_type: application/zip
publish-crates:
name: Publish to crates.io
needs: build-and-upload
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev build-essential
- uses: dtolnay/rust-toolchain@stable
- run: cargo publish --token ${{ secrets.CRATES_TOKEN }}
update-homebrew:
name: Update Homebrew Formula
needs: [create-release, build-and-upload]
runs-on: ubuntu-latest
steps:
- name: Update Homebrew Formula
uses: mislav/bump-homebrew-formula-action@v3
with:
formula-name: lc
homebrew-tap: ${{ github.repository_owner }}/homebrew-tap
tag-name: v${{ needs.create-release.outputs.version }}
download-url: https://github.com/${{ github.repository }}/releases/download/v${{ needs.create-release.outputs.version }}/lc-macos-x86_64.tar.gz
env:
COMMITTER_TOKEN: ${{ secrets.HOMEBREW_TOKEN }}