Skip to content

Bump version to 0.9.3 #28

Bump version to 0.9.3

Bump version to 0.9.3 #28

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 }}
release:
name: Create Release
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: artifacts/**/*
generate_release_notes: true
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
update-scoop:
name: Update Scoop Bucket
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 hash
id: hash
run: |
echo "windows=$(sha256sum artifacts/models-x86_64-pc-windows-msvc/models-x86_64-pc-windows-msvc.zip | cut -d ' ' -f1)" >> $GITHUB_OUTPUT
- name: Update Scoop manifest
env:
GH_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
run: |
VERSION="${GITHUB_REF_NAME#v}"
git clone https://x-access-token:${GH_TOKEN}@github.com/arimxyer/scoop-bucket.git
cd scoop-bucket
cat > bucket/models.json << EOF
{
"version": "${VERSION}",
"architecture": {
"64bit": {
"url": "https://github.com/arimxyer/models/releases/download/v${VERSION}/models-x86_64-pc-windows-msvc.zip",
"bin": [
"models.exe"
],
"hash": "${{ steps.hash.outputs.windows }}"
}
},
"homepage": "https://github.com/arimxyer/models",
"license": "MIT",
"description": "Fast CLI and TUI for browsing AI model information from models.dev"
}
EOF
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add bucket/models.json
git commit -m "Update models to ${VERSION}"
git push