@@ -61,14 +61,19 @@ jobs:
61
61
id : version
62
62
run : |
63
63
:
64
- echo "- Extract version from project"
65
- version=$( xcodebuild -scheme "${{ env.buildscheme }}" -configuration Release \
66
- -project "${{ env.projectfile }}" -showBuildSettings \
67
- | sed -nr 's/^.*MARKETING_VERSION = (.*)$/\1/p') 2>/dev/null
64
+ echo "- Extract version and bundle id from the project"
65
+ xcodebuild -scheme "${{ env.buildscheme }}" -configuration Release \
66
+ -project "${{ env.projectfile }}" -showBuildSettings 2>/dev/null > buildsettings.txt
67
+ version=$( sed -nr 's/^.*MARKETING_VERSION = (.*)$/\1/p' < buildsettings.txt)
68
68
if [[ -z $version ]] ; then
69
69
echo "::error::Unable to determine a version number for the current state of the xcode project"
70
70
exit 1
71
71
fi
72
+ bundleID=$(sed -nr 's/^.*PRODUCT_BUNDLE_IDENTIFIER = (.*)$/\1/p' < buildsettings.txt)
73
+ if [[ -z $bundleID ]] ; then
74
+ echo "::error::Unable to extract bundle id from the xcode project"
75
+ exit 1
76
+ fi
72
77
73
78
echo "- Check script inputs"
74
79
if [[ -z "${{ inputs.releaseVersion }}" || $version == "${{ inputs.releaseVersion }}" ]] ; then
@@ -114,6 +119,7 @@ jobs:
114
119
fi
115
120
116
121
echo "version=$version" >> $GITHUB_OUTPUT
122
+ echo "bundleID=$bundleID" >> $GITHUB_OUTPUT
117
123
echo "releaseName=$releaseName" >> $GITHUB_OUTPUT
118
124
echo "releaseArchivename=$releaseNameNoSpaces" >> $GITHUB_OUTPUT
119
125
echo "isPrerelease=$isPrerelease" >> $GITHUB_OUTPUT
@@ -209,41 +215,51 @@ jobs:
209
215
210
216
echo "- Sign subcomponents..."
211
217
# this is thanks to https://stackoverflow.com/a/11284404/592739
218
+ # within this section change the Internal Field Separator (IFS) to
219
+ # iterate over newline-separated paths that contain spaces
220
+ savedIFS=$IFS
221
+ IFS=$(echo -en "\n\b")
222
+
212
223
subitems=""
224
+ addsubitems()
225
+ {
226
+ if [ -z "$subitems" ] ; then
227
+ subitems="$1"
228
+ else
229
+ subitems="$subitems"$'\n'"$1"
230
+ fi
231
+ }
232
+
213
233
frameworksdir="${{ env.builddir }}/${{ env.bundlename }}/Contents/Frameworks"
214
234
if [ -d "$frameworksdir" ] ; then
215
235
frameworksdirdylibs=$(find "$frameworksdir" -depth -name "*.dylib")
216
- subitems="$frameworksdirdylibs"
236
+ if [ -n "$frameworksdirdylibs" ] ; then
237
+ addsubitems "$frameworksdirdylibs"
238
+ fi
217
239
frameworksdirbundles=$(find "$frameworksdir" -depth -type d -name "*.bundle")
218
- if [ -n "$frameworksdirbundles" -a -z "$subitems" ] ; then
219
- subitems="$frameworksdirbundles"
220
- elif [ -n "$frameworksdirbundles" ] ; then
221
- subitems="$subitems"$'\n'"$frameworksdirbundles"
240
+ if [ -n "$frameworksdirbundles" ] ; then
241
+ addsubitems "$frameworksdirbundles"
222
242
fi
223
243
frameworksdirframeworks=$(find "$frameworksdir" -depth -type d -name "*.framework")
224
- if [ -n "$frameworksdirframeworks" -a -z "$subitems" ] ; then
225
- subitems="$frameworksdirframeworks"
226
- elif [ -n "$frameworksdirframeworks" ] ; then
227
- subitems="$subitems"$'\n'"$frameworksdirframeworks"
244
+ if [ -n "$frameworksdirframeworks" ] ; then
245
+ for framework in $frameworksdirframeworks; do
246
+ frameworksubapp=$(find "$framework" -depth -type d -name "*.app")
247
+ if [ -n "$frameworksubapp" ] ; then
248
+ addsubitems "$frameworksubapp"
249
+ fi
250
+ # search for executables with limited depth to avoid ones within an .app
251
+ frameworksubexecutable=$(find "$framework" -depth 4 -type f -perm +111)
252
+ if [ -n "$frameworksubexecutable" ] ; then
253
+ addsubitems "$frameworksubexecutable"
254
+ fi
255
+ done
256
+ addsubitems "$frameworksdirframeworks"
228
257
fi
258
+
229
259
fi
230
260
# potentially grab more subitems from other places within the .app here
231
- #resourcesdir="${{ env.builddir }}/${{ env.bundlename }}/Contents/Resources"
232
- #...
233
- # not totally sure we have to manually sign the executable separately
234
- executableitem="${{ env.builddir }}/${{ env.bundlename }}/Contents/MacOS/${{ env.productname }}"
235
- if [ -x "$executableitem" -a -z "$subitems" ] ; then
236
- subitems="$executableitem"
237
- elif [ -x "$executableitem" ] ; then
238
- subitems="$subitems"$'\n'"$executableitem"
239
- else
240
- echo "::error::App bundle executable not found for signing"
241
- fi
261
+ # ie. resourcesdir="${{ env.builddir }}/${{ env.bundlename }}/Contents/Resources"
242
262
243
- # change the Internal Field Separator (IFS) to allow newline-separated
244
- # paths that contain spaces
245
- savedIFS=$IFS
246
- IFS=$(echo -en "\n\b")
247
263
for subitem in $subitems; do
248
264
xcrun codesign --force -s "${{ secrets.PROD_MACOS_CERTIFICATE_NAME }}" \
249
265
--options runtime -v "$subitem"
@@ -258,8 +274,6 @@ jobs:
258
274
if : success()
259
275
run : |
260
276
:
261
- test -d "${{ env.builddir }}/${{ env.bundlename }}" || exit 1
262
-
263
277
if [[ -z "${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}" ]] ; then
264
278
echo "::error::Secret PROD_MACOS_NOTARIZATION_APPLE_ID not defined"
265
279
exit 1
@@ -294,7 +308,7 @@ jobs:
294
308
# characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
295
309
# you're curious
296
310
297
- echo "- Notarize"
311
+ echo "- Notarize app "
298
312
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait \
299
313
2>&1 | tee notarytool-out.txt
300
314
if [ ${PIPESTATUS[0]} -ne 0 ] || grep -q Invalid notarytool-out.txt ; then
@@ -331,8 +345,6 @@ jobs:
331
345
id : dmg
332
346
run : |
333
347
:
334
- test -d "${{ env.builddir }}/${{ env.bundlename }}" || exit 1
335
-
336
348
if ! command -v create-dmg >/dev/null 2>&1 ; then
337
349
echo "::warning::Required helper script not found: create-dmg. Skipping dmg creation"
338
350
# not sure if need to do `echo "file=whatever" >> $GITHUB_OUTPUT`
@@ -365,6 +377,24 @@ jobs:
365
377
#xcrun stapler staple "${{ env.builddir }}/$imageFileName"
366
378
367
379
echo "file=${{ env.builddir }}/$imageFileName" >> $GITHUB_OUTPUT
380
+
381
+ - name : " Sign and notarize disk image"
382
+ if : success()
383
+ run : |
384
+ :
385
+ echo "- Notarize disk image"
386
+ xcrun notarytool submit "${{ steps.dmg.outputs.file }}" --keychain-profile "notarytool-profile" --wait \
387
+ 2>&1 | tee notarytool-out.txt
388
+ if [ ${PIPESTATUS[0]} -ne 0 ] || grep -q Invalid notarytool-out.txt ; then
389
+ if sed -nr '/^[[:space:]]*id: (.*)$/{s//\1/p;q;}' notarytool-out.txt > notarytool-id.txt ; then
390
+ echo "- Extract notarytool failure log"
391
+ xcrun notarytool log "$(<notarytool-id.txt)" --keychain-profile "notarytool-profile"
392
+ fi
393
+ exit 1
394
+ fi
395
+
396
+ echo "- Attach staple"
397
+ xcrun stapler staple "${{ steps.dmg.outputs.file }}"
368
398
369
399
- name : Release Notes
370
400
id : notes
0 commit comments