Skip to content

Commit

Permalink
Fix identity
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewSazonov committed Jun 19, 2024
1 parent 4b3b9af commit 2474733
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 14 deletions.
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ config_style = 'style.qss'

[ci.codesign]
bundle_id = 'org.easyscience.easydiffraction'

[ci.codesign.macos]
identity = '3rd Party Mac Developer Application: European Spallation Source Eric (W2AG9MPZ43)'
apple.identity = 'Developer ID Application: European Spallation Source Eric (W2AG9MPZ43)'
apple.team_id = 'W2AG9MPZ43'

[ci.app.icon]
dir = ['Gui', 'Resources', 'Logo']
Expand Down
50 changes: 39 additions & 11 deletions tools/Scripts/SignAppInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@

CONFIG = Config.Config(sys.argv[1], sys.argv[2])

MACOS_IDENTITY = CONFIG['ci']['codesign']['macos']['identity']
IDENTITY = CONFIG['ci']['codesign']['apple']['identity']
BUNDLE_ID = CONFIG['ci']['codesign']['bundle_id']
TEAM_ID = CONFIG['ci']['codesign']['apple']['team_id']
MACOS_CERTIFICATE_ENCODED = sys.argv[3] # Encoded content of the certificate.p12 file
MACOS_CERTIFICATE_PASSWORD = sys.argv[4] # Password associated with the certificate.p12 file
APPSTORE_NOTARIZATION_USERNAME = sys.argv[5] # Apple ID (esss.se personal account) added to https://developer.apple.com
Expand Down Expand Up @@ -102,8 +104,7 @@ def signMacos():
'security', 'import',
mac_certificate_fname,
'-k', keychain_name,
'-P', MACOS_CERTIFICATE_PASSWORD,
'-T', '/usr/bin/codesign')
'-P', MACOS_CERTIFICATE_PASSWORD)
except Exception as sub_exception:
Functions.printFailMessage(sub_message, sub_exception)
sys.exit(1)
Expand Down Expand Up @@ -138,16 +139,43 @@ def signMacos():
# Sign app installer
####################

try:
sub_message = f'display information about the code at "{CONFIG.setup_exe_path}" before signing'
Functions.run(
'codesign',
'--display', # nested code content such as helpers, frameworks, and plug-ins, should be recursively signed
'--verbose', # replace any existing signature on the path(s) given
CONFIG.setup_exe_path)
except Exception as sub_exception:
Functions.printFailMessage(sub_message, sub_exception)
sys.exit(1)
else:
Functions.printSuccessMessage(sub_message)

try:
sub_message = f'sign installer app "{CONFIG.setup_exe_path}" with imported certificate'
Functions.run(
'codesign',
'--deep', # nested code content such as helpers, frameworks, and plug-ins, should be recursively signed
'--force', # replace any existing signature on the path(s) given
'--verbose=1', # set (with a numeric value) or increments the verbosity level of output
'--timestamp', # request that a default Apple timestamp authority server be contacted to authenticate the time of signin
'--options=runtime', # specify a set of option flags to be embedded in the code signature
'--sign', MACOS_IDENTITY, # sign the code at the path(s) given using this identity
'--force', # replace any existing signature on the path(s) given
'--verbose', # set (with a numeric value) or increments the verbosity level of output
'--timestamp', # request that a default Apple timestamp authority server be contacted to authenticate the time of signin
'--options=runtime', # specify a set of option flags to be embedded in the code signature
'--keychain', keychain_name, # specify keychain name
'--identifier', BUNDLE_ID, # specify bundle id
'--sign', IDENTITY, # sign the code at the path(s) given using this identity
CONFIG.setup_exe_path)
except Exception as sub_exception:
Functions.printFailMessage(sub_message, sub_exception)
sys.exit(1)
else:
Functions.printSuccessMessage(sub_message)

try:
sub_message = f'display information about the code at "{CONFIG.setup_exe_path}" after signing'
Functions.run(
'codesign',
'--display', # nested code content such as helpers, frameworks, and plug-ins, should be recursively signed
'--verbose', # replace any existing signature on the path(s) given
CONFIG.setup_exe_path)
except Exception as sub_exception:
Functions.printFailMessage(sub_message, sub_exception)
Expand All @@ -160,7 +188,7 @@ def signMacos():
Functions.run(
'codesign',
'--verify', # verification of code signatures
'--verbose=1', # set (with a numeric value) or increments the verbosity level of output
'--verbose', # set (with a numeric value) or increments the verbosity level of output
CONFIG.setup_exe_path)
except Exception as sub_exception:
Functions.printFailMessage(sub_message, sub_exception)
Expand Down Expand Up @@ -194,7 +222,7 @@ def signMacos():
Functions.run(
'xcrun', 'notarytool', 'submit',
'--apple-id', APPSTORE_NOTARIZATION_USERNAME,
'--team-id', 'W2AG9MPZ43',
'--team-id', TEAM_ID,
'--password', APPSTORE_NOTARIZATION_PASSWORD,
'--verbose',
'--progress',
Expand Down

0 comments on commit 2474733

Please sign in to comment.