From a976fe96f51e5171865d7dcbd4242a028728a599 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 16:52:34 +0200 Subject: [PATCH 01/16] let gon generate the dmg installer and upload it --- .github/workflows/release.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 541da69c3..f7c8cf74c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -288,6 +288,11 @@ jobs: deep = true } + # generate a Disk Image + dmg { + output_path = "ArduinoCreateAgent_${{ matrix.arch }}_notarized.dmg" + volume_name = "ArduinoCreateAgent" + } # Ask Gon for zip output to force notarization process to take place. # The CI will upload the zip output zip { @@ -317,11 +322,11 @@ jobs: aws s3 cp darwin-${{ matrix.arch }}-bundle.json s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} if: ${{ needs.build.outputs.prerelease != 'true' }} - - name: Upload artifact + - name: Upload artifacts uses: actions/upload-artifact@v3 with: name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized - path: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip + path: ArduinoCreateAgent*_${{ matrix.arch }}_notarized.* #TODO remove zip upload (not needed here) if-no-files-found: error # This job is responsible for generating the installers (using installbuilder) From eb6b8e9e28d3ca26d093be48ba3acfa4b5295cfb Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 16:52:59 +0200 Subject: [PATCH 02/16] package step does not need notarization anymore --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f7c8cf74c..b9f909295 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -331,7 +331,7 @@ jobs: # This job is responsible for generating the installers (using installbuilder) package: - needs: notarize-macos + needs: build runs-on: ubuntu-20.04 env: From 214e0bdd2fdeb18f19dab4a4481e6215808cdb49 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 16:53:22 +0200 Subject: [PATCH 03/16] remove installbuilder env vars related to macos --- .github/workflows/release.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9f909295..2bc8addd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -338,13 +338,9 @@ jobs: # vars used by installbuilder INSTALLBUILDER_PATH: "/opt/installbuilder-22.10.0/bin/builder" INSTALLER_VARS: "project.outputDirectory=$PWD project.version=${GITHUB_REF##*/} workspace=$PWD realname=Arduino_Create_Agent" - # vars passed to installbuilder to install https certs automatically - CREATE_OSX_BUNDLED_MG: 0 # tell installbuilder to not create the DMG, gon will take care of that later # installbuilder will read this vars automatically (defined in installer.xml): INSTALLER_CERT_WINDOWS_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }} INSTALLER_CERT_WINDOWS_PFX: "/tmp/ArduinoCerts2020.pfx" - INSTALLER_CERT_MAC_PASSWORD: ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }} - INSTALLER_CERT_MAC_P12: "/tmp/ArduinoCerts2020.p12" strategy: fail-fast: false # if one os is failing continue nonetheless From 95321d691ceabf2ba92ec0c43481a3652bfde34d Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 16:53:57 +0200 Subject: [PATCH 04/16] remove macos from matrix --- .github/workflows/release.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2bc8addd1..ec28ec16a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -345,7 +345,7 @@ jobs: strategy: fail-fast: false # if one os is failing continue nonetheless matrix: # used to generate installers for different OS and not for runs-on - os: [ubuntu-20.04, windows-2019, macos-12] + os: [ubuntu-20.04, windows-2019] arch: [amd64] include: - os: ubuntu-20.04 @@ -366,12 +366,6 @@ jobs: extension: .exe installer-extension: .exe artifact-name: arduino-create-agent-windows-2019-amd64 - - os: macos-12 - install-builder-name: osx - executable-path: artifacts/macos/ArduinoCreateAgent.app - installer-extension: .app - artifact-name: ArduinoCreateAgent.app_amd64_notarized # this artifact contains the Contents directory - # here we support only amd64 for macos. Hopefully in the future installbuilder for macOS will be removed, see https://github.com/arduino/arduino-create-agent/issues/739 container: image: floydpink/ubuntu-install-builder:22.10.0 From 41e3181e4f3ac4d7b92c0846f99ac27b1ef85b31 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 17:41:12 +0200 Subject: [PATCH 05/16] remove macos related steps from package job --- .github/workflows/release.yml | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec28ec16a..94801eba7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -383,14 +383,6 @@ jobs: name: ${{ matrix.artifact-name }} path: ${{ matrix.executable-path }} # path expected by installbuilder - - name: unzip mac notarized bundle - working-directory: ${{ matrix.executable-path }} - run: | - apt install unzip - unzip ${{ matrix.artifact-name }}.zip - rm ${{ matrix.artifact-name }}.zip - if: matrix.os == 'macos-12' - # zip artifacts do not mantain executable permission - name: Make executable run: chmod -v +x ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}* @@ -398,7 +390,6 @@ jobs: - name: Rename executable to Arduino_Create_Agent run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent${{ matrix.extension }} - if: matrix.os != 'macos-12' - name: Rename executable to Arduino_Create_Agent_cli run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}_cli${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent_cli${{ matrix.extension }} @@ -411,10 +402,6 @@ jobs: run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_PFX }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_PFX}} if: matrix.os == 'windows-2019' - - name: Save macos signing certificate to file - run: echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_P12 }} - if: matrix.os == 'macos-12' - # installbuilder reads the env vars with certs paths and use it to sign the installer. - name: Launch Bitrock installbuilder run: | From a8ab2eb2acaf77f4f8d40aec66878a895a257324 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 17:43:28 +0200 Subject: [PATCH 06/16] remove `executable-path` and `artifact-name` vars, they are redundant --- .github/workflows/release.yml | 28 +++++++++++----------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94801eba7..283a503d6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -349,23 +349,17 @@ jobs: arch: [amd64] include: - os: ubuntu-20.04 - install-builder-name: linux - executable-path: artifacts/linux-amd64/ + platform-name: linux installer-extension: .run - artifact-name: arduino-create-agent-ubuntu-20.04-amd64 - os: windows-2019 arch: 386 - install-builder-name: windows - executable-path: artifacts/windows/ + platform-name: windows extension: .exe installer-extension: .exe - artifact-name: arduino-create-agent-windows-2019-386 - os: windows-2019 - install-builder-name: windows - executable-path: artifacts/windows/ + platform-name: windows extension: .exe installer-extension: .exe - artifact-name: arduino-create-agent-windows-2019-amd64 container: image: floydpink/ubuntu-install-builder:22.10.0 @@ -380,19 +374,19 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: ${{ matrix.artifact-name }} - path: ${{ matrix.executable-path }} # path expected by installbuilder + name: ${{ env.PROJECT_NAME }}-${{ matrix.os }}-${{ matrix.arch }} + path: artifacts/${{ matrix.platform-name }}/ # path expected by installbuilder # zip artifacts do not mantain executable permission - name: Make executable - run: chmod -v +x ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}* + run: chmod -v +x artifacts/${{ matrix.platform-name }}/${{ env.PROJECT_NAME }}* if: matrix.os == 'ubuntu-20.04' - name: Rename executable to Arduino_Create_Agent - run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent${{ matrix.extension }} + run: mv -v artifacts/${{ matrix.platform-name }}/${{ env.PROJECT_NAME }}${{ matrix.extension }} artifacts/${{ matrix.platform-name }}/Arduino_Create_Agent${{ matrix.extension }} - name: Rename executable to Arduino_Create_Agent_cli - run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}_cli${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent_cli${{ matrix.extension }} + run: mv -v artifacts/${{ matrix.platform-name }}/${{ env.PROJECT_NAME }}_cli${{ matrix.extension }} artifacts/${{ matrix.platform-name }}/Arduino_Create_Agent_cli${{ matrix.extension }} if: matrix.os == 'ubuntu-20.04' - name: Save InstallBuilder license to file @@ -405,16 +399,16 @@ jobs: # installbuilder reads the env vars with certs paths and use it to sign the installer. - name: Launch Bitrock installbuilder run: | - ${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.install-builder-name }} --verbose --license /tmp/license.xml --setvars ${{ env.INSTALLER_VARS }} architecture=${{ matrix.arch }} + ${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.platform-name }} --verbose --license /tmp/license.xml --setvars ${{ env.INSTALLER_VARS }} architecture=${{ matrix.arch }} - name: Generate archive - run: tar -czvf ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-${{ matrix.arch }}-installer.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-${{ matrix.arch }}-installer${{matrix.installer-extension}} + run: tar -czvf ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer${{matrix.installer-extension}} if: matrix.os == 'ubuntu-20.04' - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ArduinoCreateAgent-${{ matrix.install-builder-name }}-${{ matrix.arch }} + name: ArduinoCreateAgent-${{ matrix.platform-name }}-${{ matrix.arch }} path: ArduinoCreateAgent* if-no-files-found: error From bfcfbd615f5d1773b315b7d2ef18c6adfcfb100c Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Fri, 5 May 2023 17:45:08 +0200 Subject: [PATCH 07/16] remove `code-sign-mac-installers` job: we already have a notarized dmg --- .github/workflows/release.yml | 77 ----------------------------------- 1 file changed, 77 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 283a503d6..749a1c301 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -412,83 +412,6 @@ jobs: path: ArduinoCreateAgent* if-no-files-found: error - # This job will sign and notarize mac installers - code-sign-mac-installers: - needs: package - strategy: - matrix: - arch: [amd64] - - runs-on: macos-12 - steps: - - name: Download artifact - uses: actions/download-artifact@v3 - with: - name: ArduinoCreateAgent-osx-${{ matrix.arch }} - path: ArduinoCreateAgent-osx - - # zip artifacts do not mantain executable permission - - name: Make executable - run: chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.app/Contents/MacOS/* - - - name: Import Code-Signing Certificates - run: | - echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" - security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" - security default-keychain -s "${{ env.KEYCHAIN }}" - security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" - security import \ - "${{ env.INSTALLER_CERT_MAC_PATH }}" \ - -k "${{ env.KEYCHAIN }}" \ - -f pkcs12 \ - -A \ - -T "/usr/bin/codesign" \ - -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" - security set-key-partition-list \ - -S apple-tool:,apple: \ - -s \ - -k "${{ env.KEYCHAIN_PASSWORD }}" \ - "${{ env.KEYCHAIN }}" - - - name: Install gon for code signing and app notarization - run: | - wget -q https://github.com/mitchellh/gon/releases/download/v0.2.5/gon_macos.zip - unzip gon_macos.zip -d /usr/local/bin - - - name: Write gon config to file - # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) - run: | - cat > gon.config_installer.hcl < Date: Fri, 5 May 2023 18:01:49 +0200 Subject: [PATCH 08/16] adapt last `create-release` job --- .github/workflows/release.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 749a1c301..bafe2207a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -325,8 +325,8 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized - path: ArduinoCreateAgent*_${{ matrix.arch }}_notarized.* #TODO remove zip upload (not needed here) + name: ArduinoCreateAgent_${{ matrix.arch }}_notarized + path: ArduinoCreateAgent_${{ matrix.arch }}_notarized.dmg if-no-files-found: error # This job is responsible for generating the installers (using installbuilder) @@ -414,7 +414,7 @@ jobs: create-release: runs-on: ubuntu-20.04 - needs: [build, code-sign-mac-installers] + needs: [build, package] steps: - name: Checkout @@ -431,8 +431,7 @@ jobs: mkdir release chmod -v +x ArduinoCreateAgent-linux-amd64/*.run mv -v ArduinoCreateAgent-linux-amd64/* release/ - cat ArduinoCreateAgent-osx-amd64/*.tar | tar -xvf - -i -C release/ - rm -v release/._ArduinoCreateAgent*.dmg + mv -v ArduinoCreateAgent_amd64_notarized/*.dmg release/ mv -v ArduinoCreateAgent-windows*/* release/ - name: VirusTotal Scan From d057a01f32d71c1577bb70e7bfe1be664a0a04bf Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 9 May 2023 16:36:09 +0200 Subject: [PATCH 09/16] Revert "let gon generate the dmg installer and upload it" Gon is able to produce a working dmg, but there is not a link to application and a background img, for that we need `create-dmg` This reverts commit 7bb8b915d394cf91af4d9a374cd998375ed8a6fd. --- .github/workflows/release.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bafe2207a..77b1fb041 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -288,11 +288,6 @@ jobs: deep = true } - # generate a Disk Image - dmg { - output_path = "ArduinoCreateAgent_${{ matrix.arch }}_notarized.dmg" - volume_name = "ArduinoCreateAgent" - } # Ask Gon for zip output to force notarization process to take place. # The CI will upload the zip output zip { @@ -322,11 +317,11 @@ jobs: aws s3 cp darwin-${{ matrix.arch }}-bundle.json s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} if: ${{ needs.build.outputs.prerelease != 'true' }} - - name: Upload artifacts + - name: Upload artifact uses: actions/upload-artifact@v3 with: - name: ArduinoCreateAgent_${{ matrix.arch }}_notarized - path: ArduinoCreateAgent_${{ matrix.arch }}_notarized.dmg + name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized + path: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip if-no-files-found: error # This job is responsible for generating the installers (using installbuilder) From b05a2f964d8c41a108396bf7387e7cd13cfcad0c Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 9 May 2023 18:38:14 +0200 Subject: [PATCH 10/16] add step to generate and sign the dmg installer --- .github/workflows/release.yml | 102 ++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77b1fb041..ec81971de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -407,6 +407,108 @@ jobs: path: ArduinoCreateAgent* if-no-files-found: error + # This job will generate a dmg mac installer, sign/notarize it. + generate-sign-dmg: + needs: notarize-macos + strategy: + matrix: + arch: [amd64] + + runs-on: macos-12 + steps: + - name: Checkout repo with icons/background + uses: actions/checkout@v3 + with: + repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains the icons/background + token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }} + + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized + path: ArduinoCreateAgent.app + + - name: unzip artifact + working-directory: ArduinoCreateAgent.app + run: | + unzip ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip + rm ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip + + - name: Install create-dmg + run: brew install create-dmg + + - name: Genarate DMG + run: | + create-dmg \ + --volname "ArduinoCreateAgent" \ + --background "installer_icons/background.tiff" \ + --window-pos 200 120 \ + --window-size 500 320 \ + --icon-size 80 \ + --icon "ArduinoCreateAgent.app" 125 150 \ + --app-drop-link 375 150 \ + "ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg" \ + "ArduinoCreateAgent.app" + + - name: Import Code-Signing Certificates + run: | + echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > "${{ env.INSTALLER_CERT_MAC_PATH }}" + security create-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" + security default-keychain -s "${{ env.KEYCHAIN }}" + security unlock-keychain -p "${{ env.KEYCHAIN_PASSWORD }}" "${{ env.KEYCHAIN }}" + security import \ + "${{ env.INSTALLER_CERT_MAC_PATH }}" \ + -k "${{ env.KEYCHAIN }}" \ + -f pkcs12 \ + -A \ + -T "/usr/bin/codesign" \ + -P "${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}" + security set-key-partition-list \ + -S apple-tool:,apple: \ + -s \ + -k "${{ env.KEYCHAIN_PASSWORD }}" \ + "${{ env.KEYCHAIN }}" + + - name: Install gon for code signing and app notarization + run: | + wget -q https://github.com/mitchellh/gon/releases/download/v0.2.5/gon_macos.zip + unzip gon_macos.zip -d /usr/local/bin + + - name: Write gon config to file + # gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20) + run: | + cat > gon.config_installer.hcl < Date: Tue, 9 May 2023 11:43:46 +0200 Subject: [PATCH 11/16] fix `create-release` job --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ec81971de..dcdce3d1b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -511,7 +511,7 @@ jobs: create-release: runs-on: ubuntu-20.04 - needs: [build, package] + needs: [build, package, generate-sign-dmg] steps: - name: Checkout From a1ae0a906c8c46864a334f5b7a9a189a4d9cafb3 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 9 May 2023 18:44:58 +0200 Subject: [PATCH 12/16] Partially Revert "adapt last `create-release` job" This reverts commit e7c1b1dc94c0ca76412e9db8b645511c087abdf5. --- .github/workflows/release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dcdce3d1b..54c3b70fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -528,7 +528,8 @@ jobs: mkdir release chmod -v +x ArduinoCreateAgent-linux-amd64/*.run mv -v ArduinoCreateAgent-linux-amd64/* release/ - mv -v ArduinoCreateAgent_amd64_notarized/*.dmg release/ + cat ArduinoCreateAgent-osx-amd64/*.tar | tar -xvf - -i -C release/ + rm -v release/._ArduinoCreateAgent*.dmg mv -v ArduinoCreateAgent-windows*/* release/ - name: VirusTotal Scan From f822d9ca49cf04dc6356676a75ac87ef331931d2 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 9 May 2023 18:39:26 +0200 Subject: [PATCH 13/16] test new version of the installer config --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 54c3b70fb..f0f65993c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -364,6 +364,7 @@ jobs: uses: actions/checkout@v3 with: repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains install.xml + ref: remove-macos token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }} - name: Download artifact @@ -420,6 +421,7 @@ jobs: uses: actions/checkout@v3 with: repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains the icons/background + ref: remove-macos token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }} - name: Download artifact From 2e1306b4213c802efae7f3248d0b055d5f6a35e8 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Tue, 16 May 2023 15:42:31 +0200 Subject: [PATCH 14/16] Warn the user if a previous installation exists in `$HOME/Applications/` --- main.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/main.go b/main.go index 0cb55a325..0620d9e78 100755 --- a/main.go +++ b/main.go @@ -23,6 +23,7 @@ import ( "encoding/json" "flag" "os" + "os/exec" "runtime" "runtime/debug" "strconv" @@ -168,6 +169,15 @@ func loop() { log.SetLevel(log.InfoLevel) log.SetOutput(os.Stdout) + // We used to install the agent in $HOME/Applications before versions <= 1.2.7-ventura + // With version > 1.3.0 we changed the install path of the agent in /Applications. + // If we are updating manually from 1.2.7 to 1.3.0 we have to uninstall the old agent manually first. + // This check will inform the user if he needs to run the uninstall first + if runtime.GOOS == "darwin" && oldInstallExists() { + printDialog("Old agent installation of the Arduino Create Agent found, please uninstall it before launching the new one") + os.Exit(0) + } + // Instantiate Tools Tools = tools.Tools{ Directory: config.GetDataDir().String(), @@ -434,6 +444,18 @@ func loop() { }() } +// oldInstallExixts will return true if an old installation of the agent exixts (on macos) +func oldInstallExists() bool { + oldAgentPath := config.GetDefaultHomeDir().Join("Applications", "ArduinoCreateAgent") + return oldAgentPath.Exist() +} + +// printDialog will print a GUI error dialog on macos +func printDialog(dialogText string) { + oscmd := exec.Command("osascript", "-e", "display dialog \""+dialogText+"\" buttons \"OK\" with title \"Error\"") + _ = oscmd.Run() +} + func parseIni(filename string) (args []string, err error) { cfg, err := ini.LoadSources(ini.LoadOptions{IgnoreInlineComment: false, AllowPythonMultilineValues: true}, filename) if err != nil { From 8bf558daaf196c3fc3d1056af4dcd0c8722ce360 Mon Sep 17 00:00:00 2001 From: umbynos Date: Tue, 9 May 2023 18:39:40 +0200 Subject: [PATCH 15/16] Revert "test new version of the installer config" This reverts commit c528951af94dab326e01331e87745e46ea093c4f. --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f0f65993c..54c3b70fb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -364,7 +364,6 @@ jobs: uses: actions/checkout@v3 with: repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains install.xml - ref: remove-macos token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }} - name: Download artifact @@ -421,7 +420,6 @@ jobs: uses: actions/checkout@v3 with: repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains the icons/background - ref: remove-macos token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }} - name: Download artifact From fc49266e7180dba1b0dd6f0b6a007138dfe7b16f Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Thu, 18 May 2023 15:35:26 +0200 Subject: [PATCH 16/16] if the running binary is the old running one we don't do anything otherwise we break the agent after the auto-update --- main.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 0620d9e78..e37410c4a 100755 --- a/main.go +++ b/main.go @@ -444,9 +444,15 @@ func loop() { }() } -// oldInstallExixts will return true if an old installation of the agent exixts (on macos) +// oldInstallExists will return true if an old installation of the agent exists (on macos) and is not the process running func oldInstallExists() bool { oldAgentPath := config.GetDefaultHomeDir().Join("Applications", "ArduinoCreateAgent") + currentBinary, _ := os.Executable() + // if the current running binary is the old one we don't need to do anything + binIsOld, _ := paths.New(currentBinary).IsInsideDir(oldAgentPath) + if binIsOld { + return false + } return oldAgentPath.Exist() }