From a072b6735421a025437598d4021239e453414445 Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 4 Mar 2024 13:32:51 +0100 Subject: [PATCH] dmgs --- .circleci/config.yml | 11 ++++++++--- apps/remixdesktop/afterbuild.js | 18 +++-------------- apps/remixdesktop/notarizedmg.sh | 33 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 18 deletions(-) create mode 100644 apps/remixdesktop/notarizedmg.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index de0ddeacc7..c4ffe9f4b7 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -302,10 +302,15 @@ jobs: cd apps/remixdesktop yarn yarn installRipGrepMacOXarm64 - PUBLISH_FOR_PULL_REQUEST='true' USE_HARD_LINKS=false yarn dist --mac --arm64 + PUBLISH_FOR_PULL_REQUEST='false' USE_HARD_LINKS=false yarn dist --mac --arm64 yarn installRipGrepMacOXx64 - PUBLISH_FOR_PULL_REQUEST='true' USE_HARD_LINKS=false yarn dist --mac --x64 - + PUBLISH_FOR_PULL_REQUEST='false' USE_HARD_LINKS=false yarn dist --mac --x64 + - run: + name: Notarize the app + command: | + sudo apt-get install jq + cd apps/remixdesktop + zsh notarizedmg.sh - store_artifacts: path: apps/remixdesktop/release/ destination: remixdesktop-mac diff --git a/apps/remixdesktop/afterbuild.js b/apps/remixdesktop/afterbuild.js index ef0085cfb4..189cbdd527 100644 --- a/apps/remixdesktop/afterbuild.js +++ b/apps/remixdesktop/afterbuild.js @@ -1,4 +1,4 @@ -const { spawn } = require('child_process'); +const fs = require('fs'); exports.default = async function afterbuild(context) { // do not run when not on macOS @@ -10,20 +10,8 @@ exports.default = async function afterbuild(context) { const artifactPaths = context.artifactPaths const dmgs = artifactPaths.filter((dmg) => dmg.endsWith('.dmg')).map((dmg) => `'${dmg}'`) - console.log(['notarize.sh', ...dmgs]); + fs.writeFileSync('dmgs.json', JSON.stringify({ dmgs }, null, 2)) + - const child = spawn('zsh', ['notarize.sh', ...dmgs], { shell: true }); - - child.stdout.on('data', (data) => { - console.log(`stdout: ${data}`); - }); - - child.stderr.on('data', (data) => { - console.error(`stderr: ${data}`); - }); - - child.on('close', (code) => { - console.log(`child process exited with code ${code}`); - }); } diff --git a/apps/remixdesktop/notarizedmg.sh b/apps/remixdesktop/notarizedmg.sh new file mode 100644 index 0000000000..cbaa7cbbdb --- /dev/null +++ b/apps/remixdesktop/notarizedmg.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +# Path to the JSON file containing the DMG paths +JSON_FILE="dmgs.json" + +# Read the DMGs array from the JSON file +DMG_PATHS=$(jq -r '.dmgs[]' "$JSON_FILE") + +xcrun notarytool store-credentials "notarytool-password" \ + --apple-id ${APPLE_ID} \ + --team-id ${APPLE_TEAM_ID} \ + --password ${APPLE_ID_PASSWORD} + +# Loop over the DMG paths +for DMG_PATH in $DMG_PATHS; do + # Remove single quotes from the path if present + DMG_PATH_CLEANED=$(echo $DMG_PATH | tr -d "'") + + echo "Submitting $DMG_PATH_CLEANED for notarization..." + + # Run your notarytool submit command here + # Ensure you replace `your-app-specific-args` with actual arguments for your app + notarytool submit "$DMG_PATH_CLEANED" --keychain-profile "notarytool-password" --wait + + # Check for success/failure if necessary + if [ $? -eq 0 ]; then + echo "Successfully submitted $DMG_PATH_CLEANED for notarization." + else + echo "Failed to submit $DMG_PATH_CLEANED for notarization." + fi +done + +echo "All DMG submissions completed."