Bump version to 2.0.9 #15
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build Binaries | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| build: | |
| name: Build ${{ matrix.target }} on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS | |
| - target: x86_64-apple-darwin | |
| os: macos-13 | |
| arch: x86_64 | |
| suffix: apple-darwin-x86_64 | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| arch: arm64 | |
| suffix: apple-darwin-arm64 | |
| # Linux (Disabled - Uncomment if needed) | |
| # - target: x86_64-unknown-linux-gnu | |
| # os: ubuntu-22.04 | |
| # arch: x86_64 | |
| # suffix: unknown-linux-gnu-x86_64 | |
| # - target: aarch64-unknown-linux-gnu | |
| # os: ubuntu-22.04 | |
| # arch: arm64 | |
| # suffix: unknown-linux-gnu-arm64 | |
| # Windows (Disabled - Uncomment if needed) | |
| # - target: x86_64-pc-windows-msvc | |
| # os: windows-2022 | |
| # arch: x86_64 | |
| # suffix: pc-windows-msvc-x86_64 | |
| # - target: aarch64-pc-windows-msvc | |
| # os: windows-2022 | |
| # arch: arm64 | |
| # suffix: pc-windows-msvc-arm64 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Install macOS dependencies | |
| if: matrix.os == 'macos-13' || matrix.os == 'macos-14' | |
| run: | | |
| brew install cmake pkg-config | |
| - name: Install Linux dependencies | |
| if: matrix.os == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cmake pkg-config libssl-dev | |
| - name: Cache cargo registry | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: ${{ runner.os }}-${{ matrix.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Build binary | |
| run: | | |
| rustup target add ${{ matrix.target }} | |
| cargo build --release --target ${{ matrix.target }} | |
| # Strip binary for smaller size (macOS/Linux) | |
| if [ "${{ matrix.os }}" != "windows-2022" ]; then | |
| strip target/${{ matrix.target }}/release/git-ca | |
| fi | |
| - name: Create archive | |
| run: | | |
| cd target/${{ matrix.target }}/release | |
| if [ "${{ matrix.os }}" == "windows-2022" ]; then | |
| 7z a git-ca-${{ matrix.suffix }}.zip git-ca.exe | |
| else | |
| tar czf git-ca-${{ matrix.suffix }}.tar.gz git-ca | |
| fi | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: git-ca-${{ matrix.suffix }} | |
| path: target/${{ matrix.target }}/release/git-ca-${{ matrix.suffix }}.* | |
| retention-days: 30 | |
| release: | |
| name: Create Release and Update Homebrew | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| needs: build | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts/ | |
| - name: Display structure of downloaded files | |
| run: ls -R artifacts/ | |
| - name: Create Homebrew bottles | |
| run: | | |
| mkdir -p bottles | |
| cd artifacts | |
| # Rename files from git-ca-VERSION-PLATFORM.tar.gz to git-ca-VERSION.PLATFORM.bottle.tar.gz | |
| for file in git-ca-*.tar.gz; do | |
| if [ -f "$file" ]; then | |
| # Extract version and platform from filename | |
| filename=$(basename "$file" .tar.gz) | |
| version="${filename#git-ca-}" | |
| platform="${version#*-}" | |
| version="${version%-${platform}}" | |
| # Create bottle filename with dot separator | |
| bottle_name="git-ca-${version}.${platform}.bottle.tar.gz" | |
| # Copy and rename | |
| cp "$file" "../bottles/${bottle_name}" | |
| echo "Created: ${bottle_name}" | |
| fi | |
| done | |
| cd .. | |
| ls -la bottles/ | |
| - name: Get version from tag | |
| id: get_version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -v ${{ github.ref_name }} | head -n 1) | |
| if [ -z "$PREVIOUS_TAG" ]; then | |
| CHANGELOG=$(git log --pretty=format:"* %s (%an)" ${{ github.ref_name }}) | |
| else | |
| CHANGELOG=$(git log --pretty=format:"* %s (%an)" $PREVIOUS_TAG..${{ github.ref_name }}) | |
| fi | |
| echo "CHANGELOG<<EOF" >> $GITHUB_OUTPUT | |
| echo "$CHANGELOG" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Compute checksums | |
| run: | | |
| mkdir checksums | |
| cd artifacts | |
| find . -name "git-ca-*" -type f | while read file; do | |
| if [[ "$file" == *.tar.gz ]]; then | |
| sha256sum "$file" >> ../checksums/checksums.txt | |
| elif [[ "$file" == *.zip ]]; then | |
| sha256sum "$file" >> ../checksums/checksums.txt | |
| fi | |
| done | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: git-ca ${{ github.ref_name }} | |
| body: | | |
| ## Changelog | |
| ${{ steps.changelog.outputs.CHANGELOG }} | |
| ## Downloads | |
| ### Homebrew Bottles (Recommended) | |
| Install directly with: `brew install git-ca` (after `brew tap zh30/tap`) | |
| ### Manual Download | |
| **macOS (Apple Silicon)** | |
| - [git-ca-${{ steps.get_version.outputs.VERSION }}.arm64_sequoia.bottle.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/git-ca-${{ steps.get_version.outputs.VERSION }}.arm64_sequoia.bottle.tar.gz) | |
| **macOS (Intel)** | |
| - [git-ca-${{ steps.get_version.outputs.VERSION }}.x86_64_sequoia.bottle.tar.gz](https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/git-ca-${{ steps.get_version.outputs.VERSION }}.x86_sequoia.bottle.tar.gz) | |
| ## Installation | |
| ### Using Homebrew (Recommended) | |
| ```bash | |
| brew tap zh30/tap | |
| brew install git-ca | |
| ``` | |
| ### From Release | |
| Download the appropriate archive for your platform and extract it: | |
| ```bash | |
| # macOS | |
| tar -xzf git-ca-VERSION-PLATFORM.tar.gz | |
| sudo mv git-ca /usr/local/bin/ | |
| ``` | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| bottles/*.bottle.tar.gz | |
| checksums/checksums.txt | |
| artifacts/**/*.tar.gz | |
| artifacts/**/*.zip | |
| - name: Update Homebrew Formula | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TARGET_REPO_PAT: ${{ secrets.TARGET_REPO_PAT }} | |
| run: | | |
| VERSION=${{ steps.get_version.outputs.VERSION }} | |
| # Download checksums.txt from release to extract bottle checksums | |
| gh release download v${VERSION} --pattern checksums.txt --dir ./homebrew-update/ | |
| # Extract checksums for each platform | |
| ARM64_MACOS=$(grep "apple-darwin-arm64" ./homebrew-update/checksums.txt | awk '{print $1}') | |
| X86_64_MACOS=$(grep "apple-darwin-x86_64" ./homebrew-update/checksums.txt | awk '{print $1}') | |
| echo "ARM64_MACOS=${ARM64_MACOS}" | |
| echo "X86_64_MACOS=${X86_64_MACOS}" | |
| # Download source tarball and calculate checksum | |
| TARBALL_URL="https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz" | |
| TARBALL_SHA256=$(curl -L $TARBALL_URL | shasum -a 256 | awk '{print $1}') | |
| echo "Source tarball SHA256: ${TARBALL_SHA256}" | |
| # Clone homebrew-tap repository | |
| git clone https://x-access-token:${TARGET_REPO_PAT}@github.com/zh30/homebrew-tap.git | |
| cd homebrew-tap | |
| # Configure git user (required for commits) | |
| git config user.email "action@github.com" | |
| git config user.name "GitHub Actions" | |
| # Ensure push uses the token (some git versions don't persist credentials) | |
| git remote set-url origin https://x-access-token:${TARGET_REPO_PAT}@github.com/zh30/homebrew-tap.git | |
| # Create Formula directory if it doesn't exist | |
| mkdir -p Formula | |
| # Create the updated formula using printf | |
| { | |
| echo "class GitCa < Formula" | |
| echo " desc \"AI-powered Git plugin for generating meaningful commit messages\"" | |
| echo " homepage \"https://github.com/zh30/git-commit-analyzer\"" | |
| echo " url \"https://github.com/zh30/git-commit-analyzer/archive/refs/tags/v${VERSION}.tar.gz\"" | |
| echo " sha256 \"${TARBALL_SHA256}\"" | |
| echo " license \"MIT\"" | |
| echo " head \"https://github.com/zh30/git-commit-analyzer.git\", branch: \"main\"" | |
| echo "" | |
| echo " # Bottle support for pre-built binaries" | |
| echo " bottle do" | |
| echo " root_url \"https://github.com/zh30/git-commit-analyzer/releases/download/v${VERSION}\"" | |
| echo " sha256 cellar: :any, arm64_sequoia: \"${ARM64_MACOS}\"" | |
| echo " sha256 cellar: :any, x86_64_sequoia: \"${X86_64_MACOS}\"" | |
| echo " end" | |
| echo "" | |
| echo " def install" | |
| echo " bin.install \"git-ca\"" | |
| echo " end" | |
| echo "" | |
| echo " def caveats" | |
| echo " <<~EOS" | |
| echo " To use git-ca, you need a local GGUF model (llama.cpp format)." | |
| echo "" | |
| echo " The tool will automatically download the default model" | |
| echo " (unsloth/gemma-3-270m-it-GGUF) on first run, or you can:" | |
| echo " - Place GGUF files in ./models directory" | |
| echo " - Place GGUF files in ~/.cache/git-ca/models directory" | |
| echo " - Run 'git ca model' to select a model manually" | |
| echo "" | |
| echo " To set up a default model, run:" | |
| echo " git ca model" | |
| echo "" | |
| echo " Note: git-ca uses local llama.cpp inference (no remote API calls)." | |
| echo " EOS" | |
| echo " end" | |
| echo "" | |
| echo " test do" | |
| echo " assert_match version.to_s, shell_output(\"#{bin}/git-ca --version\")" | |
| echo " end" | |
| echo "end" | |
| } > Formula/git-ca.rb | |
| # Commit and push changes | |
| git add Formula/git-ca.rb | |
| git commit -m "chore: update git-ca to v${VERSION}" || echo "No changes to commit" | |
| git push | |
| - name: Notify Success | |
| run: | | |
| echo "✅ Release created successfully!" | |
| echo "✅ Homebrew formula updated!" | |
| echo "" | |
| echo "Users can now install with:" | |
| echo " brew tap zh30/tap" | |
| echo " brew install git-ca" |