-
-
Notifications
You must be signed in to change notification settings - Fork 130
/
Makefile
62 lines (51 loc) · 1.83 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
PRODUCT = $(shell /usr/bin/plutil -extract CFBundleName raw Sources/Resources/Info.plist)
VERSION = $(shell /usr/bin/plutil -extract CFBundleShortVersionString raw Sources/Resources/Info.plist)
BUNDLE_ID = $(shell /usr/bin/plutil -extract CFBundleIdentifier raw Sources/Resources/Info.plist)
BINARY = .build/apple/Products/Release/${PRODUCT}
PKG_ROOT = ./pkg/${PRODUCT}-${VERSION}
PKG_DIR = ${PKG_ROOT}/usr/local/bin
ARTIFACTS_DIR = "artifacts"
NONDIST_PKG = ${ARTIFACTS_DIR}/intermediary_${PRODUCT}-${VERSION}.pkg
PKG = ${ARTIFACTS_DIR}/${PRODUCT}-${VERSION}.pkg
CODESIGN_IDENTITY = "Developer ID Application: Kyle Crawford (Z5J8CJBUWC)"
PKG_CODESIGN_IDENTITY = "Developer ID Installer: Kyle Crawford (Z5J8CJBUWC)"
NOTARY_KEYCHAIN_PROFILE = "notarytool.dockutil.com"
${BINARY}:
swift build -c release --product ${PRODUCT} --arch arm64 --arch x86_64
xcrun codesign -s ${CODESIGN_IDENTITY} \
--options=runtime \
--timestamp \
${BINARY}
${PKG}: ${BINARY}
rm -rf "${PKG_ROOT}" || true
mkdir -p ${PKG_DIR}
mkdir -p ${ARTIFACTS_DIR}
cp ${BINARY} ${PKG_DIR}
xcrun pkgbuild --root ${PKG_ROOT} \
--identifier "${BUNDLE_ID}" \
--version "${VERSION}" \
--install-location "/" \
--sign ${PKG_CODESIGN_IDENTITY} \
${NONDIST_PKG}
productbuild --package ${NONDIST_PKG} \
--identifier "${BUNDLE_ID}" \
--version "${VERSION}" \
--sign ${PKG_CODESIGN_IDENTITY} \
${PKG}
.PHONY: build
build: ${BINARY}
.PHONY: package
package: ${PKG}
.PHONY: notarize
notarize: ${PKG}
xcrun notarytool submit ${PKG} \
--keychain-profile ${NOTARY_KEYCHAIN_PROFILE} \
--wait
.PHONY: staple
staple:
xcrun stapler staple "${PKG}"
.PHONY: clean
clean:
swift package clean
.PHONY: release
release: clean package notarize staple