From cb4013f78d41acbcc682af4ab12bfc09779ab42f Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Tue, 7 Feb 2023 18:20:55 +0100 Subject: [PATCH 1/4] add json to enable autoupdate with the new agent logic --- .github/workflows/release.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b842ba1cb..d5988313e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -283,6 +283,25 @@ jobs: run: aws s3 cp ArduinoCreateAgent.app_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job if: ${{ needs.build.outputs.prerelease != 'true' }} + - name: Generate json file used for the new autoupdate + run: | + cat > darwin-amd64-bundle.json < Date: Wed, 8 Feb 2023 15:32:15 +0100 Subject: [PATCH 2/4] binary output of the archive https://unix.stackexchange.com/questions/3675/how-can-i-get-a-base64-encoded-shax-on-the-cli --- .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 d5988313e..3f1912753 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -288,7 +288,7 @@ jobs: cat > darwin-amd64-bundle.json < Date: Wed, 8 Feb 2023 17:40:55 +0100 Subject: [PATCH 3/4] workaround to allow darwin-arm64 to autoupdate --- .github/workflows/release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f1912753..4d8cabc10 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -123,6 +123,14 @@ jobs: run: go-selfupdate ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION} if: matrix.arch != '-386' && steps.prerelease.outputs.IS_PRE != 'true' + # for now we do not distribute m1 build, this is a workaround for now + - name: Copy autoupdate file for darwin-arm64 (m1 arch) + working-directory: public/ + run: | + cp darwin-amd64.json darwin-arm64.json + cp ${TAG_VERSION}/darwin-amd64.gz ${TAG_VERSION}/darwin-arm64.gz + if: matrix.os == `macos-12` && steps.prerelease.outputs.IS_PRE != 'true' + - name: Create autoupdate files for win32 run: go-selfupdate -platform windows${{ matrix.arch }} ${{ env.PROJECT_NAME }}${{ matrix.ext }} ${TAG_VERSION} if: matrix.arch == '-386' && matrix.os == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true' From 884aadf7243e6ebb8980649fff77f6157b87cb65 Mon Sep 17 00:00:00 2001 From: Umberto Baldi Date: Wed, 8 Feb 2023 19:39:36 +0100 Subject: [PATCH 4/4] parallelize bundle creation and notarization. This will be helpful if/when we decide to build for darwin-arm64. For now this is useful because we do not offer a binary for m1 yet, `runtime.GOARCH` on an m1 machine returns ARM64, so the call for the update file would fail --- .github/workflows/release.yml | 44 +++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4d8cabc10..f9f8b6910 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -152,6 +152,11 @@ jobs: create-macos-bundle: needs: build + # for not they are exaclty the same + strategy: + matrix: + arch: [amd64, arm64] + runs-on: macos-12 env: EXE_PATH: "skel/ArduinoCreateAgent.app/Contents/MacOS/" @@ -166,7 +171,7 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: ${{ env.PROJECT_NAME }}-macos-12-amd64 + name: ${{ env.PROJECT_NAME }}-macos-12-amd64 # if we want to support darwin-arm64 in the future for real this has to change. path: ${{ env.EXE_PATH }} - name: Remove placeholder file @@ -205,18 +210,24 @@ jobs: EOF - name: Tar bundle to keep permissions - run: tar -cvf ArduinoCreateAgent.app.tar -C skel/ . + run: tar -cvf ArduinoCreateAgent.app_${{ matrix.arch }}.tar -C skel/ . - name: Upload artifacts uses: actions/upload-artifact@v3 with: if-no-files-found: error - name: ArduinoCreateAgent.app - path: ArduinoCreateAgent.app.tar + name: ArduinoCreateAgent.app_${{ matrix.arch }} + path: ArduinoCreateAgent.app_${{ matrix.arch }}.tar # The notarize-macos job will download the macos bundle from the previous job, sign, notarize and re-upload it, uploading it also on s3 download servers for the autoupdate. notarize-macos: name: Notarize bundle + + # for not they are exaclty the same + strategy: + matrix: + arch: [amd64, arm64] + runs-on: macos-12 env: GON_PATH: ${{ github.workspace }}/gon @@ -226,10 +237,10 @@ jobs: - name: Download artifact uses: actions/download-artifact@v3 with: - name: ArduinoCreateAgent.app + name: ArduinoCreateAgent.app_${{ matrix.arch }} - name: un-Tar bundle - run: tar -xvf ArduinoCreateAgent.app.tar + run: tar -xvf ArduinoCreateAgent.app_${{ matrix.arch }}.tar - name: Import Code-Signing Certificates run: | @@ -280,7 +291,7 @@ jobs: # Ask Gon for zip output to force notarization process to take place. # The CI will upload the zip output zip { - output_path = "ArduinoCreateAgent.app_notarized.zip" + output_path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip" } EOF @@ -288,33 +299,29 @@ jobs: run: gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}" - name: Upload autoupdate bundle to Arduino downloads servers - run: aws s3 cp ArduinoCreateAgent.app_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job + run: aws s3 cp ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}${GITHUB_REF/refs\/tags\//}/ # the version should be created in th the build job if: ${{ needs.build.outputs.prerelease != 'true' }} - name: Generate json file used for the new autoupdate run: | - cat > darwin-amd64-bundle.json < darwin-${{ matrix.arch }}-bundle.json <