-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from julienbordet/cicd-improve-app-preparation
script for py2app, codesign, notarization and package building
- Loading branch information
Showing
7 changed files
with
152 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
altgraph==0.17.2 | ||
macholib==1.15.2 | ||
modulegraph==0.19.2 | ||
ping3==3.0.2 | ||
py2app==0.27 | ||
pyobjc-core==8.2 | ||
pyobjc-framework-Cocoa==8.2 | ||
rumps==0.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.cs.allow-unsigned-executable-memory</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
|
||
export IDENTITY="Developer ID Application: Julien Bordet (3HLJ4AW5AX)" | ||
export NAME="MenuPing" | ||
export YOUR_BUNDLE_ID="info.bordet.menuping" | ||
|
||
echo "------------------------------------" | ||
echo "| Building and codesigning the app |" | ||
echo "------------------------------------" | ||
|
||
echo "Building through py2app" | ||
python3 setup.py py2app >/dev/null 2>&1 | ||
|
||
echo "Signing librairies code" | ||
cd dist | ||
|
||
find "${NAME}.app" -iname '*.so' -or -iname '*.dylib' | | ||
while read libfile; do | ||
codesign --sign "${IDENTITY}" \ | ||
--entitlements ../resources/entitlements.plist \ | ||
--deep "${libfile}" \ | ||
--force \ | ||
--timestamp \ | ||
--options runtime; | ||
done; | ||
|
||
echo "Done" | ||
|
||
echo "Signing the bundle" | ||
codesign --sign "${IDENTITY}" \ | ||
--entitlements ../resources/entitlements.plist \ | ||
--deep "${NAME}.app" \ | ||
--force \ | ||
--timestamp \ | ||
--options runtime; | ||
|
||
cd .. | ||
|
||
# | ||
# Creating archive for | ||
# | ||
|
||
echo "Creating archive" | ||
ditto -c -k --keepParent "dist/${NAME}.app" dist/${NAME}.zip | ||
|
||
# | ||
# @keychain:AC_PASSWORD must have been inserte into keychain thanks to | ||
# xcrun altool --store-password-in-keychain-item "AC_PASSWORD" -u "xxxx@gmail.com" -p "password" | ||
# | ||
# password must have been created in https://appleid.apple.com/account/manage / "App-Specific Passwords" | ||
# | ||
|
||
echo "Sending for notarization (can be a bit long)" | ||
xcrun altool --notarize-app -t osx -f dist/${NAME}.zip --primary-bundle-id ${YOUR_BUNDLE_ID} \ | ||
-u zejames@gmail.com --password "@keychain:AC_PASSWORD" | ||
|
||
echo "You should check the notarization result before creating the image for distribution" | ||
|
||
# | ||
# Notarization logs can be showed by | ||
# | ||
# xcrun altool --notarization-history 0 -u zejames@gmail.com --password "@keychain:AC_PASSWORD" | ||
# or | ||
# xcrun altool --verbose --notarization-history 0 -u zejames@gmail.com --password "@keychain:AC_PASSWORD" | ||
# | ||
# | ||
# Staple the App | ||
echo "After notarization, you should staple the app, with" | ||
echo " # xcrun stapler staple " "dist/${NAME}.app" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
echo "-----------------------------------------------" | ||
echo "| Creating image for application distribution |" | ||
echo "-----------------------------------------------" | ||
|
||
echo "" | ||
echo "Are you sure you did : " | ||
echo " - update every occurence of the version number in code and interface" | ||
echo " - launch build_and_sign" | ||
echo "" | ||
echo -n "Confirm (Y/n) " | ||
|
||
read answer | ||
|
||
if [ "$answer" = "n" ]; then | ||
exit 1 | ||
fi | ||
|
||
echo "Creating working directory" | ||
cur_dir=`pwd` | ||
temp_dir=`mktemp -d` | ||
temp_vol=`mktemp` | ||
|
||
if [ ! -d dist/MenuPing.app ]; then | ||
echo " --> You lied, you did not create build the app" | ||
exit 1 | ||
fi | ||
|
||
if [ -f $cur_dir"/dist/MenuPing.dmg" ]; then | ||
echo -n " --> Warning : target file dist/MenuPing.dmg already exists. Are you sure you want to overwrite ? (Y/n) " | ||
read answer | ||
|
||
if [ "$answer" = "n" ]; then | ||
exit 1 | ||
else | ||
rm $cur_dir"/dist/MenuPing.dmg" | ||
fi | ||
fi | ||
|
||
cp -a dist/MenuPing.app $temp_dir | ||
cd $temp_dir | ||
ln -s /Applications/ Applications | ||
|
||
echo -n "Creating dmgfile. " | ||
hdiutil create $temp_vol.dmg -ov -volname "MenuPing" -fs HFS+ -srcfolder $cur_dir"/dist/MenuPing.app/" >/dev/null 2>&1 | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error creating the dmgfile" | ||
exit 1 | ||
fi | ||
echo "Done" | ||
|
||
echo -n "Converting to application dmg. " | ||
hdiutil convert $temp_vol.dmg -format UDZO -o $cur_dir"/dist/MenuPing.dmg" >/dev/null 2>&1 | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Error in conversion" | ||
exit 1 | ||
fi | ||
echo "Done" |