Skip to content

chore: bump version to 0.9.8 #34

chore: bump version to 0.9.8

chore: bump version to 0.9.8 #34

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
permissions:
contents: write
jobs:
build:
name: Build ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
archive: tar.gz
- target: x86_64-apple-darwin
os: macos-latest
archive: tar.gz
- target: aarch64-apple-darwin
os: macos-latest
archive: tar.gz
- target: x86_64-pc-windows-msvc
os: windows-latest
archive: zip
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Install cross-compilation tools
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
- name: Package (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../models-${{ matrix.target }}.tar.gz models
cd ../../..
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../models-${{ matrix.target }}.zip models.exe
cd ../../..
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: models-${{ matrix.target }}
path: models-${{ matrix.target }}.${{ matrix.archive }}
package-linux:
name: Package Linux (${{ matrix.arch }})
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
include:
- arch: x86_64
target: x86_64-unknown-linux-gnu
- arch: aarch64
target: aarch64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- name: Install packaging tools
run: |
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
cargo binstall -y --version 3.6.3 cargo-deb
cargo binstall -y --version 0.20.0 cargo-generate-rpm
- name: Download compiled binary
uses: actions/download-artifact@v4
with:
name: models-${{ matrix.target }}
path: artifacts
- name: Place binary for packagers
run: |
mkdir -p target/${{ matrix.target }}/release
tar xzf artifacts/models-${{ matrix.target }}.tar.gz -C target/${{ matrix.target }}/release/
- name: Build .deb
run: cargo deb --no-build --no-strip --target ${{ matrix.target }}
- name: Build .rpm
run: cargo generate-rpm --target ${{ matrix.target }}
- name: Upload .deb
uses: actions/upload-artifact@v4
with:
name: models-deb-${{ matrix.arch }}
path: target/${{ matrix.target }}/debian/*.deb
- name: Upload .rpm
uses: actions/upload-artifact@v4
with:
name: models-rpm-${{ matrix.arch }}
path: target/${{ matrix.target }}/generate-rpm/*.rpm
release:
name: Create Release
needs: [build, package-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Generate checksums
run: |
cd artifacts
find . -type f \( -name '*.tar.gz' -o -name '*.zip' -o -name '*.deb' -o -name '*.rpm' \) -exec sha256sum {} \; | sed 's| \./[^/]*/| |' > ../SHA256SUMS
cd ..
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
artifacts/**/*
SHA256SUMS
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-crate:
name: Publish to crates.io
needs: build
if: "!contains(github.ref_name, '-')"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} --allow-dirty
update-homebrew:
name: Update Homebrew Tap
needs: release
if: "!contains(github.ref_name, '-')"
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Calculate SHA256 hashes
id: hashes
run: |
echo "x86_64_apple=$(sha256sum artifacts/models-x86_64-apple-darwin/models-x86_64-apple-darwin.tar.gz | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
echo "aarch64_apple=$(sha256sum artifacts/models-aarch64-apple-darwin/models-aarch64-apple-darwin.tar.gz | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
echo "x86_64_linux=$(sha256sum artifacts/models-x86_64-unknown-linux-gnu/models-x86_64-unknown-linux-gnu.tar.gz | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
echo "aarch64_linux=$(sha256sum artifacts/models-aarch64-unknown-linux-gnu/models-aarch64-unknown-linux-gnu.tar.gz | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
git clone https://x-access-token:${GH_TOKEN}@github.com/arimxyer/homebrew-tap.git
cd homebrew-tap
cat > Formula/models.rb << 'EOF'
# typed: false
# frozen_string_literal: true
class Models < Formula
desc "Fast CLI and TUI for browsing AI model information from models.dev"
homepage "https://github.com/arimxyer/models"
version "VERSION_PLACEHOLDER"
license "MIT"
on_macos do
if Hardware::CPU.intel?
url "https://github.com/arimxyer/models/releases/download/vVERSION_PLACEHOLDER/models-x86_64-apple-darwin.tar.gz"
sha256 "HASH_X86_64_APPLE"
def install
bin.install "models"
end
end
if Hardware::CPU.arm?
url "https://github.com/arimxyer/models/releases/download/vVERSION_PLACEHOLDER/models-aarch64-apple-darwin.tar.gz"
sha256 "HASH_AARCH64_APPLE"
def install
bin.install "models"
end
end
end
on_linux do
if Hardware::CPU.intel? && Hardware::CPU.is_64_bit?
url "https://github.com/arimxyer/models/releases/download/vVERSION_PLACEHOLDER/models-x86_64-unknown-linux-gnu.tar.gz"
sha256 "HASH_X86_64_LINUX"
def install
bin.install "models"
end
end
if Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "https://github.com/arimxyer/models/releases/download/vVERSION_PLACEHOLDER/models-aarch64-unknown-linux-gnu.tar.gz"
sha256 "HASH_AARCH64_LINUX"
def install
bin.install "models"
end
end
end
end
EOF
sed -i "s/VERSION_PLACEHOLDER/${VERSION}/g" Formula/models.rb
sed -i "s/HASH_X86_64_APPLE/${{ steps.hashes.outputs.x86_64_apple }}/g" Formula/models.rb
sed -i "s/HASH_AARCH64_APPLE/${{ steps.hashes.outputs.aarch64_apple }}/g" Formula/models.rb
sed -i "s/HASH_X86_64_LINUX/${{ steps.hashes.outputs.x86_64_linux }}/g" Formula/models.rb
sed -i "s/HASH_AARCH64_LINUX/${{ steps.hashes.outputs.aarch64_linux }}/g" Formula/models.rb
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/models.rb
git commit -m "Update models to ${VERSION}"
git push