@@ -13,18 +13,31 @@ jobs:
1313 os : [macos-latest]
1414
1515 steps :
16- - uses : actions/checkout@v3
16+ - uses : actions/checkout@v4
1717 with :
1818 submodules : true
19- - uses : conda-incubator/setup-miniconda@v2
19+ - name : set env vars
20+ run : |
21+ if [ ${{github.ref_name}} == 'juce8' ]; then
22+ echo "GUI_BRANCH=development-juce8" >> "$GITHUB_ENV"
23+ elif [ ${{github.ref_name}} == 'testing-juce8' ]; then
24+ echo "GUI_BRANCH=testing-juce8" >> "$GITHUB_ENV"
25+ else
26+ echo "Invalid branch : ${{github.ref_name}}"
27+ exit 1
28+ fi
29+ - uses : maxim-lobanov/setup-xcode@v1
30+ with :
31+ xcode-version : latest-stable
32+ - uses : conda-incubator/setup-miniconda@v3
2033 with :
2134 activate-environment : oe-python-plugin
2235 python-version : " 3.10"
2336 auto-activate-base : false
2437 - name : setup
2538 run : |
2639 cd ../..
27- git clone https://github.com/open-ephys/plugin-GUI.git --branch main
40+ git clone https://github.com/open-ephys/plugin-GUI.git --branch $GUI_BRANCH
2841 cd plugin-GUI/Build && cmake -G "Xcode" ..
2942 - name : build
3043 run : |
3548# run: cd build && ctest
3649 - name : package
3750 env :
51+ MACOS_CERTIFICATE : ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
52+ MACOS_CERTIFICATE_PWD : ${{ secrets.BUILD_CERTIFICATE_PWD }}
53+ MACOS_CERTIFICATE_NAME : ${{ secrets.BUILD_CERTIFICATE_NAME }}
54+ MACOS_CI_KEYCHAIN_PWD : ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }}
55+ PROD_MACOS_NOTARIZATION_APPLE_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }}
56+ PROD_MACOS_NOTARIZATION_TEAM_ID : ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }}
57+ PROD_MACOS_NOTARIZATION_PWD : ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }}
3858 build_dir : " Build/Release"
3959 package : PythonProcessor-mac
4060 run : |
4464 mkdir plugins
4565 cp -r $build_dir/*.bundle plugins
4666 mv $build_dir/shared .
67+
68+ # Turn our base64-encoded certificate back to a regular .p12 file
69+ echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
70+
71+ # We need to create a new keychain, otherwise using the certificate will prompt
72+ # with a UI dialog asking for the certificate password, which we can't
73+ # use in a headless CI environment
74+ security create-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain
75+ security default-keychain -s build.keychain
76+ security unlock-keychain -p $MACOS_CI_KEYCHAIN_PWD build.keychain
77+ security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
78+ security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $MACOS_CI_KEYCHAIN_PWD build.keychain
79+ /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v plugins/python-processor.bundle --deep --strict --timestamp --options=runtime
80+ /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" -v shared/libpython3.10.dylib --deep --strict --timestamp --options=runtime
81+
82+ /usr/bin/codesign -dv --verbose=4 plugins/python-processor.bundle
83+
84+ # Store the notarization credentials so that we can prevent a UI password dialog from blocking the CI
85+
86+ echo "Create keychain profile"
87+ xcrun notarytool store-credentials "notarytool-profile" --apple-id "$PROD_MACOS_NOTARIZATION_APPLE_ID" --team-id "$PROD_MACOS_NOTARIZATION_TEAM_ID" --password "$PROD_MACOS_NOTARIZATION_PWD"
88+
89+ # We can't notarize an app bundle directly, but we need to compress it as an archive.
90+ # Therefore, we create a zip file containing our app bundle, so that we can send it to the
91+ # notarization service
92+
93+ echo "Creating temp notarization archive"
94+ /usr/bin/ditto -c -k --sequesterRsrc --keepParent plugins/python-processor.bundle python-processor.zip
95+
96+ # Here we send the notarization request to the Apple's Notarization service, waiting for the result.
97+ # This typically takes a few seconds inside a CI environment, but it might take more depending on the App
98+ # characteristics. Visit the Notarization docs for more information and strategies on how to optimize it if
99+ # you're curious
100+
101+ echo "Notarize app"
102+ xcrun notarytool submit "python-processor.zip" --keychain-profile "notarytool-profile" --wait
103+
104+ # Finally, we need to "attach the staple" to our executable, which will allow our app to be
105+ # validated by macOS even when an internet connection is not available.
106+ echo "Attach staple"
107+ rm -r plugins/*
108+ /usr/bin/ditto -x -k python-processor.zip plugins
109+ xcrun stapler staple plugins/python-processor.bundle
110+
47111 zipfile=${package}_${new_plugin_ver}.zip
48112 echo "zipfile=${zipfile}" >> $GITHUB_ENV
49113 zip -r -X $zipfile plugins shared
52116 name : ${{ env.zipfile }}
53117 path : ${{ env.zipfile }}
54118 - name : deploy
55- if : github.ref == 'refs/heads/main '
119+ if : github.ref == 'refs/heads/testing-juce8 '
56120 env :
57121 artifactoryApiKey : ${{ secrets.artifactoryApiKey }}
58122 run : |
0 commit comments