From 5846e398defabf6148a15c84aa0430c2e495a8b2 Mon Sep 17 00:00:00 2001 From: munishchouhan Date: Wed, 13 Sep 2023 14:10:18 +0200 Subject: [PATCH] Added codesing with apple certificate --- .github/workflows/build.yml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 76494c5..f8017b9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,9 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: macos-latest + codesign: enabled steps: - uses: actions/checkout@v3 @@ -38,6 +41,35 @@ jobs: name: nativeCompile-${{ matrix.os }} path: ./app/build/native/nativeCompile + - name: Codesign binary + env: + MACOS_CERTIFICATE: ${{ secrets.PROD_MACOS_CERTIFICATE }} + MACOS_CERTIFICATE_PWD: ${{ secrets.PROD_MACOS_CERTIFICATE_PWD }} + MACOS_CERTIFICATE_NAME: ${{ secrets.PROD_MACOS_CERTIFICATE_NAME }} + MACOS_CI_KEYCHAIN_PWD: ${{ secrets.PROD_MACOS_CI_KEYCHAIN_PWD }} + run: | + echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12 + security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain + security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign + security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain + /usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime ./app/build/native/nativeCompile/nativeCompile-${{ matrix.os }} -v + if: ${{ matrix.codesign }} + + - name: Notarize binary + env: + PROD_MACOS_NOTARIZATION_APPLE_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_APPLE_ID }} + PROD_MACOS_NOTARIZATION_TEAM_ID: ${{ secrets.PROD_MACOS_NOTARIZATION_TEAM_ID }} + PROD_MACOS_NOTARIZATION_PWD: ${{ secrets.PROD_MACOS_NOTARIZATION_PWD }} + run: | + 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" + echo "Creating temp notarization archive" + ditto -c -k --keepParent "./app/build/native/nativeCompile" "notarization.zip" + xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait + xcrun stapler staple "./app/build/native/nativeCompile/nativeCompile-${{ matrix.os }}" + if: ${{ matrix.codesign }} + - name: Publish tests report if: failure() uses: actions/upload-artifact@v3