Skip to content

Commit eeab601

Browse files
committed
Added build automation and GitHub release workflow
- Added Makefile with build, test, and DMG creation targets - Added GitHub Actions workflow for automatic release on tags - Include smoke test to verify app launches correctly - Support automated DMG creation and GitHub Releases
1 parent f6497f0 commit eeab601

File tree

2 files changed

+129
-0
lines changed

2 files changed

+129
-0
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build-and-release:
10+
runs-on: macos-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0 # Fetch all tags
17+
18+
- name: Setup Xcode
19+
uses: maxim-lobanov/setup-xcode@v1
20+
with:
21+
xcode-version: latest-stable
22+
23+
- name: Install create-dmg
24+
run: brew install create-dmg
25+
26+
- name: Build and Create DMG
27+
run: make dmg
28+
29+
- name: Create GitHub Release
30+
uses: softprops/action-gh-release@v2
31+
with:
32+
files: .build/dmg/*.dmg
33+
generate_release_notes: true
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
.PHONY: build clean dmg test help
2+
3+
# 변수 설정
4+
PROJECT = TextOverlay.xcodeproj
5+
SCHEME = TextOverlay
6+
CONFIGURATION = Release
7+
BUILD_DIR = .build
8+
DMG_DIR = $(BUILD_DIR)/dmg
9+
APP_NAME = TextOverlay
10+
VERSION ?= $(shell git describe --tags --always)
11+
12+
help: ## Show this help message
13+
@echo "Available targets:"
14+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
15+
16+
clean: ## Clean build artifacts
17+
@echo "🧹 Cleaning build artifacts..."
18+
rm -rf $(BUILD_DIR)
19+
rm -rf $(DMG_DIR)
20+
xcodebuild clean -project $(PROJECT) -scheme $(SCHEME) -configuration $(CONFIGURATION)
21+
22+
build: ## Build the app
23+
@echo "🔨 Building $(APP_NAME)..."
24+
xcodebuild -project $(PROJECT) \
25+
-scheme $(SCHEME) \
26+
-configuration $(CONFIGURATION) \
27+
-derivedDataPath $(BUILD_DIR) \
28+
build
29+
30+
test: build ## Test the built app
31+
@echo "🧪 Testing $(APP_NAME)..."
32+
@APP_PATH="$(BUILD_DIR)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app"; \
33+
if [ ! -d "$$APP_PATH" ]; then \
34+
echo "❌ App not found at $$APP_PATH"; \
35+
exit 1; \
36+
fi; \
37+
echo "✅ App exists at $$APP_PATH"; \
38+
\
39+
if [ ! -f "$$APP_PATH/Contents/MacOS/$(APP_NAME)" ]; then \
40+
echo "❌ Executable not found"; \
41+
exit 1; \
42+
fi; \
43+
echo "✅ Executable found"; \
44+
\
45+
codesign -dv "$$APP_PATH" 2>&1 | grep -q "Signature" && \
46+
echo "✅ App is signed" || \
47+
echo "⚠️ App is not signed (expected for local builds)"; \
48+
\
49+
file "$$APP_PATH/Contents/MacOS/$(APP_NAME)" | grep -q "Mach-O" && \
50+
echo "✅ Valid Mach-O executable" || \
51+
(echo "❌ Invalid executable format"; exit 1); \
52+
\
53+
echo "🚀 Running smoke test..."; \
54+
"$$APP_PATH/Contents/MacOS/$(APP_NAME)" "Build Test" --position top,left & \
55+
APP_PID=$$!; \
56+
sleep 9; \
57+
if kill -0 $$APP_PID 2>/dev/null; then \
58+
echo "✅ App launched successfully"; \
59+
kill $$APP_PID 2>/dev/null; \
60+
else \
61+
echo "⚠️ App exited unexpectedly"; \
62+
fi; \
63+
\
64+
echo "✅ All tests passed"
65+
66+
dmg: test ## Create DMG file
67+
@echo "📦 Creating DMG for $(APP_NAME) $(VERSION)..."
68+
@mkdir -p $(DMG_DIR)
69+
@rm -f $(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg
70+
71+
# create-dmg 설치 확인
72+
@if ! command -v create-dmg &> /dev/null; then \
73+
echo "⚠️ create-dmg not found. Installing..."; \
74+
brew install create-dmg; \
75+
fi
76+
77+
# DMG 생성
78+
create-dmg \
79+
--volname "$(APP_NAME)" \
80+
--window-pos 200 120 \
81+
--window-size 600 400 \
82+
--icon-size 100 \
83+
--icon "$(APP_NAME).app" 175 120 \
84+
--hide-extension "$(APP_NAME).app" \
85+
--app-drop-link 425 120 \
86+
"$(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg" \
87+
"$(BUILD_DIR)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app"
88+
89+
@echo "✅ DMG created: $(DMG_DIR)/$(APP_NAME)-$(VERSION).dmg"
90+
91+
version: ## Show current version
92+
@echo "Current version: $(VERSION)"
93+
94+
.DEFAULT_GOAL := help

0 commit comments

Comments
 (0)