-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (80 loc) · 3.2 KB
/
Copy pathMakefile
File metadata and controls
95 lines (80 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
SHELL = /bin/bash
APP_NAME = Launchyard
SCHEME = Launchyard
PROJECT = Launchyard.xcodeproj
CONFIGURATION = Release
BUILD_DIR = $(CURDIR)/.build
APP_PATH = $(BUILD_DIR)/Build/Products/$(CONFIGURATION)/$(APP_NAME).app
ZIP_NAME = $(APP_NAME).zip
# Override these or set in environment / keychain
# SIGNING_IDENTITY = "Developer ID Application: Your Name (TEAMID)"
# TEAM_ID = "YOURTEAMID"
.DEFAULT_GOAL = build
# ── Build ────────────────────────────────────────────────────
.PHONY: build
build:
xcodebuild \
-project "$(PROJECT)" \
-scheme "$(SCHEME)" \
-configuration $(CONFIGURATION) \
-derivedDataPath "$(BUILD_DIR)" \
-arch arm64 \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO
@echo "✅ Built $(APP_PATH)"
# ── Sign ─────────────────────────────────────────────────────
.PHONY: sign
sign: build
@test -n "$(SIGNING_IDENTITY)" || (echo "❌ Set SIGNING_IDENTITY"; exit 1)
codesign \
--force \
--deep \
--sign "$(SIGNING_IDENTITY)" \
--options runtime \
--timestamp \
"$(APP_PATH)"
@echo "✅ Signed $(APP_PATH)"
# ── Zip ──────────────────────────────────────────────────────
.PHONY: zip
zip: sign
@rm -f "$(ZIP_NAME)"
ditto -c -k --keepParent "$(APP_PATH)" "$(ZIP_NAME)"
@echo "✅ Created $(ZIP_NAME)"
# ── Notarize ─────────────────────────────────────────────────
# Prerequisites:
# 1. Store credentials once:
# xcrun notarytool store-credentials "AC_PASSWORD" \
# --apple-id "you@example.com" \
# --team-id "YOURTEAMID" \
# --password "app-specific-password"
#
# 2. Then run:
# make notarize SIGNING_IDENTITY="Developer ID Application: ..." TEAM_ID="YOURTEAMID"
.PHONY: notarize
notarize: zip
@test -n "$(TEAM_ID)" || (echo "❌ Set TEAM_ID"; exit 1)
@echo "📤 Submitting to Apple notarization service..."
xcrun notarytool submit "$(ZIP_NAME)" \
--keychain-profile "AC_PASSWORD" \
--team-id "$(TEAM_ID)" \
--wait
@echo "📎 Stapling notarization ticket..."
xcrun stapler staple "$(APP_PATH)"
@echo "♻️ Re-zipping with stapled ticket..."
@rm -f "$(ZIP_NAME)"
ditto -c -k --keepParent "$(APP_PATH)" "$(ZIP_NAME)"
@echo "✅ $(ZIP_NAME) is notarized and ready to distribute"
@open -R "$(ZIP_NAME)"
# ── Verify ───────────────────────────────────────────────────
.PHONY: verify
verify:
codesign --verify --deep --strict "$(APP_PATH)"
spctl --assess --type execute "$(APP_PATH)"
stapler validate "$(APP_PATH)"
@echo "✅ All checks passed"
# ── Clean ────────────────────────────────────────────────────
.PHONY: clean
clean:
rm -rf "$(BUILD_DIR)" "$(ZIP_NAME)"
@echo "🧹 Cleaned"