-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
97 lines (73 loc) · 2.78 KB
/
Makefile
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
96
97
# This is adapted from https://github.com/exelban/stats/blob/master/Makefile
APP = Spotiqueue
BUNDLE_ID = com.rustlingbroccoli.Spotiqueue
TEAM_ID := $(shell security find-certificate -c "Developer ID Application:" | grep "alis" | awk 'NF { print $$NF }' | tr -d \(\)\")
BUILD_PATH = $(PWD)/build
APP_PATH = "$(BUILD_PATH)/$(APP).app"
ZIP_PATH = "$(BUILD_PATH)/$(APP).zip"
AC_USERNAME := $(shell pass spotiqueue-itc-signing | grep email | awk '{print $$2}')
export AC_PASSWORD := $(shell pass spotiqueue-itc-signing | grep app-specific-pass | awk '{print $$2}')
.PHONY: build
build: archive notarize sign make-zip
# --- MAIN WORKFLOW FUNCTIONS --- #
.PHONY: archive
archive: clean
@echo "Exporting application archive..."
xcodebuild \
-scheme $(APP) \
-destination 'generic/platform=OS X' \
-configuration Release archive \
-archivePath $(BUILD_PATH)/$(APP).xcarchive
@echo "Application built, starting the export archive..."
xcodebuild -exportArchive \
-exportOptionsPlist "$(PWD)/ExportOptions.plist" \
-archivePath $(BUILD_PATH)/$(APP).xcarchive \
-exportPath $(BUILD_PATH)
ditto -c -k --keepParent $(APP_PATH) $(ZIP_PATH)
@echo "Project archived successfully"
.PHONY: notarize
notarize:
@echo "Submitting app for notarization..."
xcrun notarytool submit \
--team-id $(TEAM_ID) \
--apple-id $(AC_USERNAME) \
--password "$$AC_PASSWORD" \
--wait \
$(ZIP_PATH)
@echo "Done. Application submitted to the notarization center"
.PHONY: sign
sign:
@echo "Going to staple an application..."
xcrun stapler staple $(APP_PATH)
spctl -a -t exec -vvv $(APP_PATH)
@echo "Spotiqueue successfully stapled"
.PHONY: make-zip
make-zip: VERSION = $(shell /usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$(APP_PATH)/Contents/Info.plist")
make-zip: sign
ditto -c -k --keepParent $(APP_PATH) $(ZIP_PATH)
cp -v $(ZIP_PATH) updates/Spotiqueue-v$(VERSION).zip
~/Downloads/Sparkle-1.27.1/bin/generate_appcast updates/
.PHONY: prepare-dSYM
prepare-dSYM:
@echo "Zipping dSYMs..."
cd $(BUILD_PATH)/Spotiqueue.xcarchive/dSYMs && zip -r $(PWD)/dSYMs.zip .
@echo "Created zip with dSYMs"
# --- HELPERS --- #
.PHONY: clean
clean:
rm -rf $(BUILD_PATH)
if [ -a $(PWD)/dSYMs.zip ]; then rm $(PWD)/dSYMs.zip; fi;
if [ -a $(PWD)/Spotiqueue.dmg ]; then rm $(PWD)/Spotiqueue.dmg; fi;
.PHONY: next-version
next-version:
versionNumber=$$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$(PWD)/Spotiqueue/Info.plist") ;\
@echo "Actual version is: $$versionNumber" ;\
versionNumber=$$((versionNumber + 1)) ;\
@echo "Next version is: $$versionNumber" ;\
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $$versionNumber" "$(PWD)/Spotiqueue/Info.plist" ;\
.PHONY: history
history:
xcrun notarytool history \
--team-id ${TEAM_ID} \
--apple-id $(AC_USERNAME) \
--password "$$AC_PASSWORD"