|
28 | 28 | outputs: |
29 | 29 | semVerStr: ${{ steps.determine-version.outputs.version }} |
30 | 30 | semVerNum: ${{steps.determine-number.outputs.number}} |
| 31 | + revisionNum: ${{steps.determine-number.outputs.revision}} |
31 | 32 | steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
32 | 36 | - id: determine-version |
33 | 37 | shell: pwsh |
34 | 38 | run: | |
|
45 | 49 | run: | |
46 | 50 | SEM_VER_NUM=$(echo "${{ steps.determine-version.outputs.version }}" | sed -E 's/([0-9]+\.[0-9]+\.[0-9]+).*/\1/') |
47 | 51 | echo "number=${SEM_VER_NUM}" >> "$GITHUB_OUTPUT" |
| 52 | + REVISION_NUM=`git rev-list --count HEAD` |
| 53 | + echo "revision=${REVISION_NUM}" >> "$GITHUB_OUTPUT" |
48 | 54 |
|
49 | 55 | build-binary: |
50 | 56 | name: Build java app image |
@@ -110,10 +116,76 @@ jobs: |
110 | 116 | name: cryptomator-cli-mac-${{ matrix.architecture }} |
111 | 117 | path: ./target/cryptomator-cli.app |
112 | 118 | if-no-files-found: error |
113 | | - - name: TODO sign binaries |
114 | | - run: echo "TODO sign it and notarize it" |
| 119 | + - name: Patch Cryptomator.app |
| 120 | + run: | |
| 121 | + sed -i '' "s|###BUNDLE_SHORT_VERSION_STRING###|${VERSION_NO}|g" ./target/Cryptomator.app/Contents/Info.plist |
| 122 | + sed -i '' "s|###BUNDLE_VERSION###|${REVISION_NO}|g" ./target/Cryptomator.app/Contents/Info.plist |
| 123 | + echo -n "$PROVISIONING_PROFILE_BASE64" | base64 --decode --output ./target/Cryptomator.app/Contents/embedded.provisionprofile |
| 124 | + env: |
| 125 | + VERSION_NO: ${{ needs.prepare.outputs.semVerNum }} |
| 126 | + REVISION_NO: ${{ needs.prepare.outputs.revisionNum }} |
| 127 | + PROVISIONING_PROFILE_BASE64: ${{ secrets.MACOS_PROVISIONING_PROFILE_BASE64 }} |
| 128 | + - name: Install codesign certificate |
| 129 | + run: | |
| 130 | + # create variables |
| 131 | + CERTIFICATE_PATH=$RUNNER_TEMP/codesign.p12 |
| 132 | + KEYCHAIN_PATH=$RUNNER_TEMP/codesign.keychain-db |
| 133 | +
|
| 134 | + # import certificate and provisioning profile from secrets |
| 135 | + echo -n "$CODESIGN_P12_BASE64" | base64 --decode --output $CERTIFICATE_PATH |
| 136 | +
|
| 137 | + # create temporary keychain |
| 138 | + security create-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH |
| 139 | + security set-keychain-settings -lut 900 $KEYCHAIN_PATH |
| 140 | + security unlock-keychain -p "$CODESIGN_TMP_KEYCHAIN_PW" $KEYCHAIN_PATH |
| 141 | +
|
| 142 | + # import certificate to keychain |
| 143 | + security import $CERTIFICATE_PATH -P "$CODESIGN_P12_PW" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH |
| 144 | + security list-keychain -d user -s $KEYCHAIN_PATH |
| 145 | + env: |
| 146 | + CODESIGN_P12_BASE64: ${{ secrets.MACOS_CODESIGN_P12_BASE64 }} |
| 147 | + CODESIGN_P12_PW: ${{ secrets.MACOS_CODESIGN_P12_PW }} |
| 148 | + CODESIGN_TMP_KEYCHAIN_PW: ${{ secrets.MACOS_CODESIGN_TMP_KEYCHAIN_PW }} |
| 149 | + - name: Codesign |
| 150 | + run: | |
| 151 | + echo "Codesigning jdk files..." |
| 152 | + find ./target/cryptomator-cli.app/Contents/runtime/Contents/Home/lib/ -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; |
| 153 | + find ./target/cryptomator-cli.app/Contents/runtime/Contents/Home/lib/ \( -name 'jspawnhelper' -o -name 'pauseengine' -o -name 'simengine' \) -exec codesign --force -o runtime -s ${CODESIGN_IDENTITY} {} \; |
| 154 | + echo "Codesigning jar contents..." |
| 155 | + find ./target/cryptomator-cli.app/Contents/runtime/Contents/MacOS -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; |
| 156 | + for JAR_PATH in `find ./target/cryptomator-cli.app -name "*.jar"`; do |
| 157 | + if [[ `unzip -l ${JAR_PATH} | grep '.dylib\|.jnilib'` ]]; then |
| 158 | + JAR_FILENAME=$(basename ${JAR_PATH}) |
| 159 | + OUTPUT_PATH=${JAR_PATH%.*} |
| 160 | + echo "Codesigning libs in ${JAR_FILENAME}..." |
| 161 | + unzip -q ${JAR_PATH} -d ${OUTPUT_PATH} |
| 162 | + find ${OUTPUT_PATH} -name '*.dylib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; |
| 163 | + find ${OUTPUT_PATH} -name '*.jnilib' -exec codesign --force -s ${CODESIGN_IDENTITY} {} \; |
| 164 | + rm ${JAR_PATH} |
| 165 | + pushd ${OUTPUT_PATH} > /dev/null |
| 166 | + zip -qr ../${JAR_FILENAME} * |
| 167 | + popd > /dev/null |
| 168 | + rm -r ${OUTPUT_PATH} |
| 169 | + fi |
| 170 | + done |
| 171 | + echo "Codesigning Cryptomator.app..." |
| 172 | + sed -i '' "s|###APP_IDENTIFIER_PREFIX###|${TEAM_IDENTIFIER}.|g" dist/mac/cryptomator-cli.entitlements |
| 173 | + sed -i '' "s|###TEAM_IDENTIFIER###|${TEAM_IDENTIFIER}|g" dist/mac/cryptomator-cli.entitlements |
| 174 | + codesign --force --deep --entitlements dist/mac/cryptomator-cli.entitlements -o runtime -s ${CODESIGN_IDENTITY} ./target/cryptomator-cli.app |
| 175 | + env: |
| 176 | + CODESIGN_IDENTITY: ${{ secrets.MACOS_CODESIGN_IDENTITY }} |
| 177 | + TEAM_IDENTIFIER: ${{ secrets.MACOS_TEAM_IDENTIFIER }} |
115 | 178 | - name: Zip binary for release |
116 | 179 | run: zip -r ./${{ matrix.artifact-name}} ./target/cryptomator-cli.app |
| 180 | + - name: Notarize .dmg |
| 181 | + if: startsWith(github.ref, 'refs/tags/') |
| 182 | + uses: cocoalibs/xcode-notarization-action@v1 |
| 183 | + with: |
| 184 | + app-path: ${{ matrix.artifact-name }} |
| 185 | + apple-id: ${{ secrets.MACOS_NOTARIZATION_APPLE_ID }} |
| 186 | + password: ${{ secrets.MACOS_NOTARIZATION_PW }} |
| 187 | + team-id: ${{ secrets.MACOS_NOTARIZATION_TEAM_ID }} |
| 188 | + xcode-path: '/Applications/Xcode_16.app' |
117 | 189 | - name: Create detached GPG signature with key 615D449FE6E6A235 |
118 | 190 | run: | |
119 | 191 | echo "${GPG_PRIVATE_KEY}" | gpg --batch --quiet --import |
|
0 commit comments