Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Formula/zanadir.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ class Zanadir < Formula
homepage "https://github.com/MustacheCase/zanadir"
license "MIT"

# Get the latest version from git tags
version = "0.1.1"

stable do
url "https://github.com/MustacheCase/zanadir/archive/refs/tags/0.0.5.tar.gz"
sha256 "9a54d970ee594f21395f0de3210bce8c0059a48d2cf84911207baad125cb9a13"
version "0.0.5"
url "https://github.com/MustacheCase/zanadir/archive/#{version}.tar.gz"
sha256 "84165bcdc12ff56058ff438fe7cbbdd3d694c24bb9f4d2f546184ce83ca0adbc"
version version
end

head "https://github.com/MustacheCase/zanadir.git", branch: "main"
Expand Down
43 changes: 43 additions & 0 deletions scripts/update-brew-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/bin/bash

# Script to update Homebrew formula with latest version
# Usage: ./scripts/update-brew-version.sh

set -e

# Get the latest version tag (only tags without 'v' prefix like 0.1.1, not v0.0.5)
LATEST_VERSION=$(git tag -l | grep -v '^v' | sort -V | tail -1)
echo "Latest version: $LATEST_VERSION"

# Verify we have a valid version
if [[ -z "$LATEST_VERSION" ]]; then
echo "Error: No tags found without 'v' prefix"
exit 1
fi

# Version number is the same as the tag (no 'v' prefix to remove)
VERSION_NUMBER=$LATEST_VERSION

# Download the tarball and calculate SHA256
TARBALL_URL="https://github.com/MustacheCase/zanadir/archive/${LATEST_VERSION}.tar.gz"
echo "Downloading: $TARBALL_URL"

# Download and calculate SHA256
SHA256=$(curl -sL "$TARBALL_URL" | shasum -a 256 | cut -d' ' -f1)
echo "SHA256: $SHA256"

# Update the formula file
FORMULA_FILE="Formula/zanadir.rb"

# Create backup
cp "$FORMULA_FILE" "$FORMULA_FILE.backup"

# Update version and SHA256 in the formula
sed -i.bak "s/version = \"[^\"]*\"/version = \"$VERSION_NUMBER\"/" "$FORMULA_FILE"
sed -i.bak "s/sha256 \"[^\"]*\"/sha256 \"$SHA256\"/" "$FORMULA_FILE"

# Clean up ALL backup files
rm -f "$FORMULA_FILE.backup" "$FORMULA_FILE.bak"

echo "Updated $FORMULA_FILE with version $VERSION_NUMBER and SHA256 $SHA256"
echo "Don't forget to commit and push these changes!"
Loading