Skip to content

Commit

Permalink
Update name in release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoPologruto committed May 30, 2024
1 parent bad65d8 commit cf7aa86
Showing 1 changed file with 52 additions and 49 deletions.
101 changes: 52 additions & 49 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ permissions:

env:
# As defined by the Taskfile's PROJECT_NAME variable
PROJECT_NAME: arduino-create-agent
PROJECT_NAME: arduino-cloud-agent
TARGET: "/CreateAgent/Stable/"
VERSION_TARGET: "arduino-create-static/agent-metadata/"
AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623
Expand Down Expand Up @@ -132,7 +132,7 @@ jobs:
- 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'

- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down Expand Up @@ -186,8 +186,8 @@ jobs:
- name: Make executable
run: chmod -v +x ${{ env.EXE_PATH }}${{ env.PROJECT_NAME }}

- name: Rename executable to Arduino_Create_Agent
run: mv -v ${{ env.EXE_PATH }}${{ env.PROJECT_NAME }} ${{ env.EXE_PATH }}Arduino_Create_Agent
- name: Rename executable to Arduino_Cloud_Agent
run: mv -v ${{ env.EXE_PATH }}${{ env.PROJECT_NAME }} ${{ env.EXE_PATH }}Arduino_Cloud_Agent

- name: get year
run: echo "YEAR=$(date "+%Y")" >> $GITHUB_ENV
Expand All @@ -199,8 +199,8 @@ jobs:
<key>CFBundleIconFile</key> <string>AppIcon.icns</string>
<key>CFBundleName</key> <string>Arduino Create Agent</string>
<key>CFBundleExecutable</key> <string>Arduino_Create_Agent</string>
<key>CFBundleName</key> <string>Arduino Cloud Agent</string>
<key>CFBundleExecutable</key> <string>Arduino_Cloud_Agent</string>
<key>CFBundleIdentifier</key> <string>create.arduino.cc</string>
<key>CFBundleVersion</key> <string>${GITHUB_REF##*/}</string>
Expand All @@ -215,14 +215,14 @@ jobs:
EOF
- name: Tar bundle to keep permissions
run: tar -cvf ArduinoCreateAgent.app_${{ matrix.arch }}.tar -C skel/ .
run: tar -cvf ArduinoCloudAgent.app_${{ matrix.arch }}.tar -C skel/ .

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ArduinoCreateAgent.app_${{ matrix.arch }}
path: ArduinoCreateAgent.app_${{ matrix.arch }}.tar
name: ArduinoCloudAgent.app_${{ matrix.arch }}
path: ArduinoCloudAgent.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:
Expand All @@ -243,10 +243,10 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ArduinoCreateAgent.app_${{ matrix.arch }}
name: ArduinoCloudAgent.app_${{ matrix.arch }}

- name: un-Tar bundle
run: tar -xvf ArduinoCreateAgent.app_${{ matrix.arch }}.tar
run: tar -xvf ArduinoCloudAgent.app_${{ matrix.arch }}.tar

- name: Import Code-Signing Certificates
run: |
Expand Down Expand Up @@ -300,7 +300,7 @@ jobs:
run: gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"

- name: Zip output app bundle
run: ditto -c -k ArduinoCreateAgent.app/ ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
run: ditto -c -k ArduinoCreateAgent.app/ ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip

- name: Remove gon used for code signing
run: |
Expand All @@ -311,19 +311,19 @@ jobs:
run: |
wget -q https://github.com/Bearer/gon/releases/download/v0.0.27/gon_macos.zip
unzip gon_macos.zip -d /usr/local/bin
- name: Write gon config to file
run: |
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
# See: https://github.com/Bearer/gon#configuration-file
notarize {
path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip"
path = "ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip"
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
}
EOF
- name: Notarize app bundle
run: |
gon -log-level=debug -log-json "${{ env.GON_CONFIG_PATH }}"
Expand All @@ -337,15 +337,15 @@ jobs:
if: ${{ needs.build.outputs.prerelease != 'true' }}

- name: Upload autoupdate bundle to Arduino downloads servers
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
run: aws s3 cp ArduinoCloudAgent.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)"
"Sha256": "$(shasum -a 256 ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip | awk '{print $1}' | xxd -r -p | base64)"
}
EOF
if: ${{ needs.build.outputs.prerelease != 'true' }}
Expand All @@ -358,8 +358,8 @@ jobs:
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized
path: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
name: ArduinoCloudAgent.app_${{ matrix.arch }}_notarized
path: ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip
if-no-files-found: error

# This job is responsible for generating the installers (using installbuilder)
Expand Down Expand Up @@ -424,15 +424,18 @@ jobs:
- name: Launch Bitrock installbuilder
run: ${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.installbuilder-name }} --verbose --license /tmp/license.xml --setvars ${{ env.INSTALLER_VARS }} architecture=${{ matrix.arch }}

- name: Rename installer to ArduinoCloudAgent
run: mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer${{matrix.installer-extension}} ArduinoCloudAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer${{matrix.installer-extension}}

- name: Generate archive
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}}
run: tar -czvf ArduinoCloudAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer.tar.gz ArduinoCloudAgent-${GITHUB_REF##*/}-${{ matrix.platform-name }}-${{ matrix.arch }}-installer${{matrix.installer-extension}}
if: matrix.os == 'ubuntu-20.04'

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ArduinoCreateAgent-${{ matrix.platform-name }}-${{ matrix.arch }}
path: ArduinoCreateAgent*
name: ArduinoCloudAgent-${{ matrix.platform-name }}-${{ matrix.arch }}
path: ArduinoCloudAgent*
if-no-files-found: error

# This job will sign the Windows installer
Expand All @@ -449,17 +452,17 @@ jobs:
# We are hardcoding the path for signtool because is not present on the windows PATH env var by default.
# Keep in mind that this path could change when upgrading to a new runner version
SIGNTOOL_PATH: "C:/Program Files (x86)/Windows Kits/10/bin/10.0.19041.0/x86/signtool.exe"

strategy:
matrix:
arch: [amd64, 386]

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ArduinoCreateAgent-windows-${{ matrix.arch }}
name: ArduinoCloudAgent-windows-${{ matrix.arch }}

- name: Save Win signing certificate to file
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_CER }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_CER}}

Expand All @@ -468,15 +471,15 @@ jobs:
CERT_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
CONTAINER_NAME: ${{ secrets.INSTALLER_CERT_WINDOWS_CONTAINER }}
# https://stackoverflow.com/questions/17927895/automate-extended-validation-ev-code-signing-with-safenet-etoken
run: |
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino Create Agent" -f ${{ env.INSTALLER_CERT_WINDOWS_CER}} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "ArduinoCreateAgent-${GITHUB_REF##*/}-windows-${{ matrix.arch }}-installer.exe"
run: |
"${{ env.SIGNTOOL_PATH }}" sign -d "Arduino Cloud Agent" -f ${{ env.INSTALLER_CERT_WINDOWS_CER}} -csp "eToken Base Cryptographic Provider" -k "[{{${{ env.CERT_PASSWORD }}}}]=${{ env.CONTAINER_NAME }}" -fd sha256 -tr http://timestamp.digicert.com -td SHA256 -v "ArduinoCloudAgent-${GITHUB_REF##*/}-windows-${{ matrix.arch }}-installer.exe"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
name: ArduinoCreateAgent-windows-${{ matrix.arch }}-signed
path: ArduinoCreateAgent-*-windows-${{ matrix.arch }}-installer.exe
name: ArduinoCloudAgent-windows-${{ matrix.arch }}-signed
path: ArduinoCloudAgent-*-windows-${{ matrix.arch }}-installer.exe

# This job will generate a dmg mac installer, sign/notarize it.
generate-sign-dmg:
Expand All @@ -496,30 +499,30 @@ jobs:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: ArduinoCreateAgent.app_${{ matrix.arch }}_notarized
path: ArduinoCreateAgent.app
name: ArduinoCloudAgent.app_${{ matrix.arch }}_notarized
path: ArduinoCloudAgent.app

- name: unzip artifact
working-directory: ArduinoCreateAgent.app
working-directory: ArduinoCloudAgent.app
run: |
unzip ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
rm ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip
unzip ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip
rm ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip
- name: Install create-dmg
run: brew install create-dmg

- name: Genarate DMG
run: |
create-dmg \
--volname "ArduinoCreateAgent" \
--volname "ArduinoCloudAgent" \
--background "installer_icons/background.tiff" \
--window-pos 200 120 \
--window-size 500 320 \
--icon-size 80 \
--icon "ArduinoCreateAgent.app" 125 150 \
--icon "ArduinoCloudAgent.app" 125 150 \
--app-drop-link 375 150 \
"ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg" \
"ArduinoCreateAgent.app"
"ArduinoCloudAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg" \
"ArduinoCloudAgent.app"
- name: Import Code-Signing Certificates
run: |
Expand Down Expand Up @@ -549,7 +552,7 @@ jobs:
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
run: |
cat > gon.config_installer.hcl <<EOF
source = ["ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg"]
source = ["ArduinoCloudAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg"]
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}-installer"
sign {
Expand All @@ -558,7 +561,7 @@ jobs:
# Ask Gon for zip output to force notarization process to take place.
zip {
output_path = "ArduinoCreateAgent.app_${{ matrix.arch }}_notarized.zip"
output_path = "ArduinoCloudAgent.app_${{ matrix.arch }}_notarized.zip"
}
EOF
Expand All @@ -567,13 +570,13 @@ jobs:

# tar dmg file to keep executable permission
- name: Tar files to keep permissions
run: tar -cvf ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.tar ArduinoCreateAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg
run: tar -cvf ArduinoCloudAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.tar ArduinoCloudAgent-${GITHUB_REF##*/}-osx-${{ matrix.arch }}-installer.dmg

- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ArduinoCreateAgent-osx-${{ matrix.arch }}
path: ArduinoCreateAgent*.tar
name: ArduinoCloudAgent-osx-${{ matrix.arch }}
path: ArduinoCloudAgent*.tar
if-no-files-found: error

create-release:
Expand All @@ -594,11 +597,11 @@ jobs:
- name: prepare artifacts for the release
run: |
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-windows*-signed/* release/
chmod -v +x ArduinoCloudAgent-linux-amd64/*.run
mv -v ArduinoCloudAgent-linux-amd64/* release/
cat ArduinoCloudAgent-osx-amd64/*.tar | tar -xvf - -i -C release/
rm -v release/._ArduinoCloudAgent*.dmg
mv -v ArduinoCloudAgent-windows*-signed/* release/
- name: VirusTotal Scan
id: virustotal_step
Expand Down

0 comments on commit cf7aa86

Please sign in to comment.