-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
46 lines (35 loc) · 1.89 KB
/
build.sh
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
#!/bin/sh
set -ex
rm -rf tmp || echo "no tmp dir; continuing"
rm -rf build || echo "no build dir; continuing"
export MACOS_DEVELOPMENT_TEAM="2K5J2584NX"
export MACOS_CODE_SIGN_IDENTITY="Developer ID Application: The University of Tromso (2K5J2584NX)"
export MACOS_CODE_SIGN_IDENTITY_INSTALLER="Developer ID Installer: The University of Tromso (2K5J2584NX)"
APP_NAME="MacDivvun.service"
PKG_NAME="MacDivvun.pkg"
pod update && pod install
xcodebuild -scheme MacDivvun -workspace MacDivvun.xcworkspace -configuration Release archive -clonedSourcePackagesDirPath tmp/src -derivedDataPath tmp/derived -archivePath build/app.xcarchive \
CODE_SIGN_STYLE=Manual DEVELOPMENT_TEAM="$MACOS_DEVELOPMENT_TEAM" CODE_SIGN_IDENTITY="$MACOS_CODE_SIGN_IDENTITY" -allowProvisioningUpdates \
OTHER_CODE_SIGN_FLAGS=--options=runtime || exit 1
rm -rf "$APP_NAME"
mv "build/app.xcarchive/Products/Applications/$APP_NAME" .
echo "Notarizing bundle"
xcnotary notarize "$APP_NAME" --override-path-type app -d "$INPUT_MACOS_DEVELOPER_ACCOUNT" -p "$INPUT_MACOS_NOTARIZATION_APP_PWD"
stapler validate "$APP_NAME"
VERSION=`/usr/libexec/PlistBuddy -c "Print CFBundleShortVersionString" "$APP_NAME/Contents/Info.plist"`
pkgbuild --component MacDivvun.service \
--ownership recommended \
--install-location /Library/Services \
--version $VERSION \
no.divvun.MacDivvun.pkg
productbuild --distribution scripts/dist.xml \
--version $VERSION \
--package-path . \
MacDivvun-unsigned.pkg
productsign --sign "$MACOS_CODE_SIGN_IDENTITY_INSTALLER" MacDivvun-unsigned.pkg "$PKG_NAME"
pkgutil --check-signature "$PKG_NAME"
echo "Notarizing installer"
xcrun notarytool submit -v --apple-id "$INPUT_MACOS_DEVELOPER_ACCOUNT" --password "$INPUT_MACOS_NOTARIZATION_APP_PWD" --team-id "$MACOS_DEVELOPMENT_TEAM" --wait "$PKG_NAME"
xcrun stapler staple "$PKG_NAME"
spctl --assess -vv --type install "$PKG_NAME"
stapler validate "$PKG_NAME"