website icon indicating copy to clipboard operation
website copied to clipboard

[PAGE ISSUE]: 'Build and release a macOS app'

Open mmattes opened this issue 2 years ago • 1 comments

Page URL

https://docs.flutter.dev/deployment/macos/

Page source

https://github.com/flutter/website/tree/main/src/deployment/macos.md

Describe the problem

In Create a build archive with Codemagic CLI tools Point 13. Package the App the following code snipped is mentioned. My keychain for some reason contained multiple certs with the common name containing "Mac Developer Installer" so it found multiple common names which it simply concatenated into the variable INSTALLER_CERT_NAME

APP_NAME=$(find $(pwd) -name "*.app")
PACKAGE_NAME=$(basename "$APP_NAME" .app).pkg
xcrun productbuild --component "$APP_NAME" /Applications/ unsigned.pkg

INSTALLER_CERT_NAME=$(keychain list-certificates \
          | jq '.[]
            | select(.common_name
            | contains("Mac Developer Installer"))
            | .common_name' \
          | xargs)
xcrun productsign --sign "$INSTALLER_CERT_NAME" unsigned.pkg "$PACKAGE_NAME"
rm -f unsigned.pkg 

Expected fix

Changing it to jq '[.[]...][0] will only retrun the first common name of the cert which contains "Mac Developer Installer" in its common name.

APP_NAME=$(find $(pwd) -name "*.app")
PACKAGE_NAME=$(basename "$APP_NAME" .app).pkg
xcrun productbuild --component "$APP_NAME" /Applications/ unsigned.pkg

INSTALLER_CERT_NAME=$(keychain list-certificates \
          | jq '[.[]
            | select(.common_name
            | contains("Mac Developer Installer"))
            | .common_name][0]' \
          | xargs)
xcrun productsign --sign "$INSTALLER_CERT_NAME" unsigned.pkg "$PACKAGE_NAME"
rm -f unsigned.pkg 

Additional context

No response

mmattes avatar Sep 06 '22 21:09 mmattes

Made The Changes To MacOS.md File Please Check If Found Any Decrepancy https://github.com/flutter/website/pull/7529

Hirdey-1999 avatar Sep 08 '22 01:09 Hirdey-1999

Fixed in https://github.com/flutter/website/pull/7529. Closing.

atsansone avatar May 17 '23 05:05 atsansone