Skip to content

Commit

Permalink
improvements to build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptingosx committed Jan 4, 2024
1 parent 4febdbf commit 463d0c7
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ When you run `desktoppr` with the `manage` verb, it will read the settings from

The idea is to run `desktoppr manage` with a LaunchAgent plist at login and/or at regular intervals. You can find [a sample LaunchAgent plist here](examples/com.scriptingosx.desktopprmanage.plist). The sample LaunchAgent will run `desktoppr manage` at login and every three hours (10800 sec). You can build a pkg that installs the desktoppr binary, the LaunchAgent plist and an image file very early in the deployment workflow and then desktoppr sets the desktop background when the user reaches the desktop for the first time.

For Ventura and higher, binaries and applications run by LaunchAgents need to be approved with a `com.apple.servicemanagement` profile so they appear as managed in the login items section in Settings.app. The above sample configuration profile contains those settings, as well.


desktoppr uses the following keys:

Expand Down
10 changes: 5 additions & 5 deletions desktoppr.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@
C6DFA08222B77599009E16BE /* Run Script (BuildNumber) */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 12;
buildActionMask = 8;
files = (
);
inputFileListPaths = (
Expand All @@ -184,9 +184,9 @@
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
runOnlyForDeploymentPostprocessing = 1;
shellPath = /bin/zsh;
shellScript = "buildNumber=$(/usr/libexec/PlistBuddy -c \"Print BuildNumber\" \"$SRCROOT/desktoppr/Info.plist\")\n\nnewBuildNumber=$(($buildNumber + 1))\n\n/usr/libexec/PlistBuddy -c \"Set :BuildNumber $newBuildNumber\" \"$SRCROOT/desktoppr/Info.plist\"\nxcrun agvtool new-version $newBuildNumber\n";
shellScript = "buildNumber=$(xcrun agvtool what-version -terse)\n\nnewBuildNumber=$(($buildNumber + 1))\n\nxcrun agvtool new-version $newBuildNumber\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
Expand Down Expand Up @@ -347,7 +347,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 213;
CURRENT_PROJECT_VERSION = 215;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = JME5BW3F3R;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -365,7 +365,7 @@
buildSettings = {
CODE_SIGN_IDENTITY = "Developer ID Application";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 213;
CURRENT_PROJECT_VERSION = 215;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_TEAM = JME5BW3F3R;
ENABLE_HARDENED_RUNTIME = YES;
Expand Down
2 changes: 0 additions & 2 deletions desktoppr/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildNumber</key>
<integer>213</integer>
<key>CFBundleIdentifier</key>
<string>com.scriptingosx.desktoppr</string>
<key>CFBundleName</key>
Expand Down
15 changes: 6 additions & 9 deletions pkgAndNotarize.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
pkg_name="$PRODUCT_NAME"
identifier="$PRODUCT_BUNDLE_IDENTIFIER"
version="$MARKETING_VERSION"
build_number=$(/usr/libexec/PlistBuddy -c "Print BuildNumber" "$SRCROOT/desktoppr/Info.plist")
build_number="$CURRENT_PROJECT_VERSION"
min_os_version="$MACOSX_DEPLOYMENT_TARGET"

build_dir="$BUILD_DIR"
Expand Down Expand Up @@ -53,7 +53,7 @@ echo "note: Installer cert ID: $sign_cert"
echo

# print environment variables
env | sort
# env | sort

echo

Expand Down Expand Up @@ -126,8 +126,10 @@ echo
# staple
xcrun stapler staple "$product_path"

echo

# also create a zip archive
zippath="$artifacts_dir/$pkg_name-$version.zip"
zippath="$artifacts_dir/$pkg_name-$version-$build_number.zip"
echo "note: zip archive: $zippath"
zip "$zippath" -j "$pkgroot"/usr/local/bin/desktoppr

Expand All @@ -136,15 +138,10 @@ echo "note: notarizing zip archive"
xcrun notarytool submit "$zippath" \
--keychain-profile "$credential_profile" \
--wait
xcrun stapler staple "$product_path"


echo
echo '## Done!'


exit 0


# notify
osascript -e "display notification \"$pkg_name ($version, $build_number) built and notarized\""

Expand Down

0 comments on commit 463d0c7

Please sign in to comment.