Skip to content
Open
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
35 changes: 35 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build-and-release:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all tags

- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable

- name: Install create-dmg
run: brew install create-dmg

- name: Build and Create DMG
run: make dmg

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: .build/dmg/*.dmg
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
94 changes: 94 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
.PHONY: build clean dmg test help

# Configuration
PROJECT = TextOverlay.xcodeproj
SCHEME = TextOverlay
CONFIGURATION = Release
BUILD_DIR = .build
DMG_DIR = $(BUILD_DIR)/dmg
APP_NAME = TextOverlay
VERSION ?= $(shell git describe --tags --always)

help: ## Show this help message
@echo "Available targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'

clean: ## Clean build artifacts
@echo "🧹 Cleaning build artifacts..."
rm -rf $(BUILD_DIR)
rm -rf $(DMG_DIR)
xcodebuild clean -project $(PROJECT) -scheme $(SCHEME) -configuration $(CONFIGURATION)

build: ## Build the app
@echo "🔨 Building $(APP_NAME)..."
xcodebuild -project $(PROJECT) \
-scheme $(SCHEME) \
-configuration $(CONFIGURATION) \
-derivedDataPath $(BUILD_DIR) \
build

test: build ## Test the built app
@echo "🧪 Testing $(APP_NAME)..."
@APP_PATH="$(BUILD_DIR)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app"; \
if [ ! -d "$$APP_PATH" ]; then \
echo "❌ App not found at $$APP_PATH"; \
exit 1; \
fi; \
echo "✅ App exists at $$APP_PATH"; \
\
if [ ! -f "$$APP_PATH/Contents/MacOS/$(APP_NAME)" ]; then \
echo "❌ Executable not found"; \
exit 1; \
fi; \
echo "✅ Executable found"; \
\
codesign -dv "$$APP_PATH" 2>&1 | grep -q "Signature" && \
echo "✅ App is signed" || \
echo "⚠️ App is not signed (expected for local builds)"; \
\
file "$$APP_PATH/Contents/MacOS/$(APP_NAME)" | grep -q "Mach-O" && \
echo "✅ Valid Mach-O executable" || \
(echo "❌ Invalid executable format"; exit 1); \
\
echo "🚀 Running smoke test..."; \
"$$APP_PATH/Contents/MacOS/$(APP_NAME)" "Build Test" --position top,left & \
APP_PID=$$!; \
sleep 9; \
if kill -0 $$APP_PID 2>/dev/null; then \
echo "✅ App launched successfully"; \
kill $$APP_PID 2>/dev/null; \
else \
echo "⚠️ App exited unexpectedly"; \
fi; \
\
echo "✅ All tests passed"

dmg: test ## Create DMG file
@echo "📦 Creating DMG for $(APP_NAME) $(VERSION)..."
@mkdir -p $(DMG_DIR)
@rm -f $(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg

# Check create-dmg installation
@if ! command -v create-dmg &> /dev/null; then \
echo "⚠️ create-dmg not found. Installing..."; \
brew install create-dmg; \
fi

# Create DMG
create-dmg \
--volname "$(APP_NAME)" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "$(APP_NAME).app" 175 120 \
--hide-extension "$(APP_NAME).app" \
--app-drop-link 425 120 \
"$(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg" \
"$(BUILD_DIR)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app"

@echo "✅ DMG created: $(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg"

version: ## Show current version
@echo "Current version: $(VERSION)"

.DEFAULT_GOAL := help