Skip to content

add json to enable autoupdate with the new agent logic #759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 46 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -144,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/"
Expand All @@ -158,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
Expand Down Expand Up @@ -197,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
Expand All @@ -218,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: |
Expand Down Expand Up @@ -272,22 +291,37 @@ 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

- name: Sign and notarize binary
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-${{ matrix.arch }}-bundle.json <<EOF
{
"Version": "${GITHUB_REF/refs\/tags\//}",
"Sha256": "$(shasum -a 256 ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip | awk '{print $1}' | xxd -r -p | base64)"
}
EOF
if: ${{ needs.build.outputs.prerelease != 'true' }}

- name: Upload autoupdate files to Arduino downloads servers
run: |
aws s3 cp darwin-${{ matrix.arch }}-bundle.json s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
if: ${{ needs.build.outputs.prerelease != 'true' }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ArduinoCreateAgent.app_notarized
path: ArduinoCreateAgent.app_notarized.zip
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)
Expand Down Expand Up @@ -340,7 +374,8 @@ jobs:
install-builder-name: osx
executable-path: artifacts/macos/ArduinoCreateAgent.app
installer-extension: .app
artifact-name: ArduinoCreateAgent.app_notarized # this artifact contains the Contents directory
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
Expand Down