Skip to content

Commit f286fe0

Browse files
committed
build: add version management and build tooling
- Add scripts/bump-version.sh for coordinated version updates - Updates version in package.json, Cargo.toml, tauri.conf.json, and Info.plist - Ensures version consistency across all project files - Provides clear instructions for tagging and releasing - Add Makefile for common build tasks - Simplifies development workflow - Standardizes build commands across platforms
1 parent 9f6e738 commit f286fe0

File tree

2 files changed

+134
-0
lines changed

2 files changed

+134
-0
lines changed

Makefile

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# Makefile for Claudia - Homebrew distribution
2+
3+
# Variables
4+
VERSION := $(shell grep '^version' src-tauri/Cargo.toml | head -1 | cut -d'"' -f2)
5+
DIST_NAME := Claudia-$(VERSION)-darwin
6+
BUILD_DIR := src-tauri/target/universal-apple-darwin/release/bundle
7+
8+
# Phony targets
9+
.PHONY: all clean build release cask test sign notarize help deps
10+
11+
# Default target
12+
all: build
13+
14+
# Help target
15+
help:
16+
@echo "Claudia Homebrew Build System"
17+
@echo "=============================="
18+
@echo "Available targets:"
19+
@echo " make build - Build the application for macOS (creates DMG)"
20+
@echo " make release - Create a release DMG for Homebrew"
21+
@echo " make cask - Update the Homebrew cask with latest SHA"
22+
@echo " make test - Test the Homebrew cask locally"
23+
@echo " make sign - Sign the application (requires Developer ID)"
24+
@echo " make notarize - Notarize the application (requires Apple account)"
25+
@echo " make clean - Clean build artifacts"
26+
@echo " make help - Show this help message"
27+
28+
# Clean build artifacts
29+
clean:
30+
@echo "Cleaning build artifacts..."
31+
rm -rf dist
32+
rm -rf src-tauri/target/release/bundle
33+
rm -rf src-tauri/target/universal-apple-darwin/release/bundle
34+
rm -f *.dmg
35+
36+
# Install dependencies
37+
deps:
38+
@echo "Installing dependencies..."
39+
bun install
40+
cd src-tauri && cargo fetch
41+
42+
# Build the application
43+
build: deps
44+
@echo "Building Claudia v$(VERSION)..."
45+
@echo "Note: Use './sign.sh' to build a universal binary with proper signing"
46+
@echo "Building for current architecture only..."
47+
bun run build
48+
cd src-tauri && cargo tauri build
49+
50+
# Create release DMG
51+
release: build
52+
@echo "Creating release DMG..."
53+
@if [ -f "$(BUILD_DIR)/dmg/Claudia.dmg" ]; then \
54+
cp "$(BUILD_DIR)/dmg/Claudia.dmg" "Claudia-$(VERSION).dmg"; \
55+
echo "DMG created: Claudia-$(VERSION).dmg"; \
56+
echo "SHA256: $$(shasum -a 256 Claudia-$(VERSION).dmg | awk '{print $$1}')"; \
57+
else \
58+
echo "Error: DMG not found. Make sure 'dmg' is in your tauri.conf.json targets."; \
59+
exit 1; \
60+
fi
61+
62+
# Update cask with current SHA
63+
cask: release
64+
$(eval SHA256 := $(shell shasum -a 256 Claudia-$(VERSION).dmg | awk '{print $$1}'))
65+
@echo "Updating cask with SHA256: $(SHA256)"
66+
@sed -i '' "s/sha256 \".*\"/sha256 \"$(SHA256)\"/" Casks/claudia.rb
67+
@sed -i '' "s/version \".*\"/version \"$(VERSION)\"/" Casks/claudia.rb
68+
@echo "Cask updated!"
69+
70+
# Test the cask locally
71+
test:
72+
@echo "Testing Homebrew cask..."
73+
export HOMEBREW_NO_AUTO_UPDATE=1 && \
74+
export HOMEBREW_NO_INSTALL_FROM_API=1 && \
75+
brew install --cask Casks/claudia.rb
76+
brew audit --new --cask claudia
77+
brew style --fix Casks/claudia.rb
78+
79+
# Sign the application (requires Apple Developer certificate)
80+
sign:
81+
@echo "Signing application..."
82+
@echo "Note: This requires a valid Apple Developer ID certificate"
83+
codesign --deep --force --verify --verbose --sign "Developer ID Application: YOUR NAME (TEAM_ID)" \
84+
--options runtime \
85+
--entitlements src-tauri/entitlements.plist \
86+
$(BUILD_DIR)/macos/Claudia.app
87+
88+
# Notarize the application (requires Apple Developer account)
89+
notarize: sign
90+
@echo "Notarizing application..."
91+
@echo "Creating ZIP for notarization..."
92+
cd $(BUILD_DIR)/macos && zip -r Claudia.zip Claudia.app
93+
xcrun notarytool submit $(BUILD_DIR)/macos/Claudia.zip \
94+
--apple-id "YOUR_APPLE_ID" \
95+
--team-id "YOUR_TEAM_ID" \
96+
--password "YOUR_APP_PASSWORD" \
97+
--wait
98+
xcrun stapler staple $(BUILD_DIR)/macos/Claudia.app

scripts/bump-version.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Script to bump version across all files
4+
# Usage: ./scripts/bump-version.sh 1.0.0
5+
6+
set -e
7+
8+
if [ -z "$1" ]; then
9+
echo "Usage: $0 <version>"
10+
echo "Example: $0 1.0.0"
11+
exit 1
12+
fi
13+
14+
VERSION=$1
15+
16+
echo "Bumping version to $VERSION..."
17+
18+
# Update package.json
19+
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" package.json && rm package.json.bak
20+
21+
# Update Cargo.toml
22+
sed -i.bak "s/^version = \".*\"/version = \"$VERSION\"/" src-tauri/Cargo.toml && rm src-tauri/Cargo.toml.bak
23+
24+
# Update tauri.conf.json
25+
sed -i.bak "s/\"version\": \".*\"/\"version\": \"$VERSION\"/" src-tauri/tauri.conf.json && rm src-tauri/tauri.conf.json.bak
26+
27+
# Update Info.plist
28+
sed -i.bak "s/<string>.*<\/string><!-- VERSION -->/<string>$VERSION<\/string><!-- VERSION -->/" src-tauri/Info.plist && rm src-tauri/Info.plist.bak
29+
30+
echo "✅ Version bumped to $VERSION in all files"
31+
echo ""
32+
echo "Next steps:"
33+
echo "1. Review the changes: git diff"
34+
echo "2. Commit: git commit -am \"chore: bump version to v$VERSION\""
35+
echo "3. Tag: git tag -a v$VERSION -m \"Release v$VERSION\""
36+
echo "4. Push: git push && git push --tags"

0 commit comments

Comments
 (0)