Skip to content

Commit 9d43a63

Browse files
authored
Change release filenames and finalize CI (#584)
* change path for s3 sync * add old path for autoupdate (we cannot autoupdate config.ini) * update (and remove "Bridge") from config.ini * fix naming: every os has also arch and general improvements * use arrays in matrix && rename operating-system to os * add step to update version file * uniform test.yml
1 parent 22552fb commit 9d43a63

File tree

3 files changed

+87
-74
lines changed

3 files changed

+87
-74
lines changed

.github/workflows/release.yml

+73-59
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ on:
66
- "[0-9]+.[0-9]+.[0-9]+*"
77

88
env:
9-
TARGET: "/CreateAgent/"
9+
TARGET: "/CreateAgent/Stable"
10+
OLD_TARGET: "/CreateBridge/" # compatibility with older releases (we can't change config.ini)
11+
VERSION_TARGET: "arduino-create-static/agent-metadata/"
1012
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
1113
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
1214
AWS_REGION: "us-east-1" # or https://github.com/aws/aws-cli/issues/5623
@@ -20,21 +22,20 @@ jobs:
2022
build:
2123
strategy:
2224
matrix:
25+
os: [ubuntu-18.04, windows-2019, macos-10.15]
26+
arch: [-amd64]
2327
include:
24-
- operating-system: ubuntu-18.04
25-
- operating-system: windows-2019
28+
- os: windows-2019
2629
arch: -386
2730
ext: ".exe"
28-
- operating-system: windows-2019
29-
arch: -amd64
31+
- os: windows-2019
3032
ext: ".exe"
31-
- operating-system: macos-10.15
3233

3334
defaults:
3435
run:
3536
shell: bash
3637

37-
runs-on: ${{ matrix.operating-system }}
38+
runs-on: ${{ matrix.os }}
3839

3940
steps:
4041
- name: Set env vars
@@ -64,7 +65,7 @@ jobs:
6465
# dependencies used for compiling the GUI
6566
- name: Install Dependencies (Linux)
6667
run: sudo apt update && sudo apt install -y --no-install-recommends build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev
67-
if: matrix.operating-system == 'ubuntu-18.04'
68+
if: matrix.os == 'ubuntu-18.04'
6869

6970
- name: Install Go deps
7071
# Since 10/23/2019 pwsh is the default shell
@@ -89,38 +90,38 @@ jobs:
8990

9091
- name: Build the Agent for linux
9192
run: task build
92-
if: matrix.operating-system == 'ubuntu-18.04'
93+
if: matrix.os == 'ubuntu-18.04'
9394

9495
# build the agent without GUI support (no tray icon)
9596
- name: Build the Agent-cli
9697
run: task build-cli
97-
if: matrix.operating-system == 'ubuntu-18.04'
98+
if: matrix.os == 'ubuntu-18.04'
9899

99100
# the manifest is required by windows GUI apps, otherwise the binary will crash with: "Unable to create main window: TTM_ADDTOOL failed" (for reference https://github.com/lxn/walk/issues/28)
100101
# rsrc will produce a *.syso file that should get automatically recognized by go build command and linked into an executable.
101102
- name: Download tool to embed manifest in win binary
102103
run: go get github.com/akavel/rsrc
103-
if: matrix.operating-system == 'windows-2019'
104+
if: matrix.os == 'windows-2019'
104105

105106
# building the agent for win requires a different task because of an extra flag
106107
- name: Build the Agent for win32
107108
env:
108109
GOARCH: 386 # 32bit architecture (for support)
109110
GO386: 387 # support old instruction sets without MMX (used in the Pentium 4) (will be deprecated in GO > 1.15 https://golang.org/doc/go1.15)
110111
run: task build-win
111-
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-386'
112+
if: matrix.os == 'windows-2019' && matrix.arch == '-386'
112113

113114
- name: Build the Agent for win64
114115
run: task build-win # GOARCH=amd64 by default on the runners
115-
if: matrix.operating-system == 'windows-2019' && matrix.arch == '-amd64'
116+
if: matrix.os == 'windows-2019' && matrix.arch == '-amd64'
116117

117118
- name: Build the Agent for macos
118119
env:
119120
MACOSX_DEPLOYMENT_TARGET: 10.11 # minimum supported version for mac
120121
CGO_CFLAGS: -mmacosx-version-min=10.11
121122
CGO_LDFLAGS: -mmacosx-version-min=10.11
122123
run: task build
123-
if: matrix.operating-system == 'macos-10.15'
124+
if: matrix.os == 'macos-10.15'
124125

125126
# this will create `public/` dir with compressed full bin (<version>/<os>-<arch>.gz) and a json file
126127
- name: Create autoupdate files
@@ -129,17 +130,19 @@ jobs:
129130

130131
- name: Create autoupdate files for win32
131132
run: go-selfupdate -platform windows${{ matrix.arch }} arduino-create-agent${{ matrix.ext }} ${TAG_VERSION}
132-
if: matrix.arch == '-386' && steps.prerelease.outputs.IS_PRE != 'true'
133+
if: matrix.arch == '-386' && matrix.os == 'windows-2019' && steps.prerelease.outputs.IS_PRE != 'true'
133134

134135
- name: Upload autoupdate files to Arduino downloads servers
135-
run: aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
136+
run: |
137+
aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
138+
aws s3 sync public/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.OLD_TARGET }}
136139
if: steps.prerelease.outputs.IS_PRE != 'true'
137140

138141
# config.ini is required by the executable when it's run
139142
- name: Upload artifacts
140143
uses: actions/upload-artifact@v2
141144
with:
142-
name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }}
145+
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
143146
path: |
144147
arduino-create-agent*
145148
config.ini
@@ -148,16 +151,19 @@ jobs:
148151
# The code-sign-mac-executable job will download the macos artifact from the previous job, sign e notarize the binary and re-upload it.
149152
code-sign-mac-executable:
150153
needs: build
151-
runs-on: macos-10.15
152-
env:
153-
RUNS_ON: macos-10.15 # used to parametrize filenames
154+
strategy:
155+
matrix: # to allow support for future architectures
156+
os: [macos-10.15]
157+
arch: [-amd64]
158+
159+
runs-on: ${{ matrix.os }}
154160

155161
steps:
156162
- name: Download artifact
157163
uses: actions/download-artifact@v2
158164
with:
159-
name: arduino-create-agent-${{ env.RUNS_ON }}
160-
path: arduino-create-agent-${{ env.RUNS_ON }}
165+
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
166+
path: arduino-create-agent
161167

162168
- name: Import Code-Signing Certificates
163169
run: |
@@ -177,7 +183,7 @@ jobs:
177183
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
178184
run: |
179185
cat > gon.config.hcl <<EOF
180-
source = ["arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent"]
186+
source = ["arduino-create-agent/arduino-create-agent"]
181187
bundle_id = "cc.arduino.arduino-agent"
182188
sign {
183189
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
@@ -191,16 +197,18 @@ jobs:
191197
192198
- name: Code sign and notarize app
193199
run: |
194-
echo "gon will notarize executable in arduino-create-agent-${{ env.RUNS_ON }}/arduino-create-agent"
200+
echo "gon will notarize executable in arduino-create-agent/arduino-create-agent"
195201
gon -log-level=debug -log-json gon.config.hcl
196202
timeout-minutes: 30
197203

198204
# This step will overwrite the non signed mac artifact (arduino-create-agent-${{ env.RUNS_ON }})
199205
- name: Upload artifact
200206
uses: actions/upload-artifact@v2
201207
with:
202-
name: arduino-create-agent-${{ env.RUNS_ON }}
203-
path: arduino-create-agent-${{ env.RUNS_ON }}
208+
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
209+
path: |
210+
arduino-create-agent
211+
!arduino-create-agent.zip
204212
if-no-files-found: error
205213

206214
# This job is responsible for generating the installers (using installbuilder)
@@ -226,26 +234,26 @@ jobs:
226234
strategy:
227235
fail-fast: false # if one os is failing continue nonetheless
228236
matrix: # used to generate installers for different OS and not for runs-on
229-
237+
os: [ubuntu-18.04, windows-2019, macos-10.15]
238+
arch: [-amd64]
230239
include:
231-
- operating-system: ubuntu-18.04
232-
install-builder-name: linux-x64
240+
- os: ubuntu-18.04
241+
install-builder-name: linux
233242
executable-path: artifacts/linux-amd64/
234-
- operating-system: windows-2019
243+
- os: windows-2019
235244
arch: -386
236245
browser: edge
237246
install-builder-name: windows
238247
executable-path: artifacts/windows/
239248
extension: .exe
240249
installer-extension: .exe
241-
- operating-system: windows-2019
242-
arch: -amd64
250+
- os: windows-2019
243251
browser: edge
244252
install-builder-name: windows
245253
executable-path: artifacts/windows/
246254
extension: .exe
247255
installer-extension: .exe
248-
- operating-system: macos-10.15
256+
- os: macos-10.15
249257
browser: safari
250258
install-builder-name: osx
251259
executable-path: 'skel/ArduinoCreateAgent.app/Contents/MacOS/'
@@ -264,31 +272,31 @@ jobs:
264272
- name: Download artifact
265273
uses: actions/download-artifact@v2
266274
with:
267-
name: arduino-create-agent-${{ matrix.operating-system }}${{ matrix.arch }}
275+
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
268276
path: ${{ matrix.executable-path }} # path expected by installbuilder
269277

270278
# zip artifacts do not mantain executable permission
271279
- name: Make executable
272280
run: chmod -v +x ${{ matrix.executable-path }}arduino-create-agent*
273-
if: matrix.operating-system == 'ubuntu-18.04' || matrix.operating-system == 'macos-10.15'
281+
if: matrix.os == 'ubuntu-18.04' || matrix.os == 'macos-10.15'
274282

275283
- name: Rename executable to Arduino_Create_Agent
276284
run: mv -v ${{ matrix.executable-path }}arduino-create-agent${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent${{ matrix.extension }}
277285

278286
- name: Rename executable to Arduino_Create_Agent_cli
279287
run: mv -v ${{ matrix.executable-path }}arduino-create-agent_cli${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent_cli${{ matrix.extension }}
280-
if: matrix.operating-system == 'ubuntu-18.04'
288+
if: matrix.os == 'ubuntu-18.04'
281289

282290
- name: Save InstallBuilder license to file
283291
run: echo "${{ secrets.INSTALLER_LICENSE }}" > /tmp/license.xml
284292

285293
- name: Save Win signing certificate to file
286294
run: echo "${{ secrets.INSTALLER_CERT_WINDOWS_PFX }}" | base64 --decode > ${{ env.INSTALLER_CERT_WINDOWS_PFX}}
287-
if: matrix.operating-system == 'windows-2019'
295+
if: matrix.os == 'windows-2019'
288296

289297
- name: Save macos signing certificate to file
290298
run: echo "${{ secrets.INSTALLER_CERT_MAC_P12 }}" | base64 --decode > ${{ env.INSTALLER_CERT_MAC_P12 }}
291-
if: matrix.operating-system == 'macos-10.15'
299+
if: matrix.os == 'macos-10.15'
292300

293301
# win(edge),mac(safari) -> CERT_INSTALL and win,mac:(ff,chrome) -> CHOICE_CERT_INSTALL
294302
# installbuilder reads the env vars with certs paths and use it to sign the installer.
@@ -300,17 +308,17 @@ jobs:
300308
cp -vr ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome${{matrix.installer-extension}}
301309
mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CC${{matrix.installer-extension}} ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox${{matrix.installer-extension}}
302310
rm -r ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-C*
303-
if: matrix.operating-system == 'windows-2019' || matrix.operating-system == 'macos-10.15'
311+
if: matrix.os == 'windows-2019' || matrix.os == 'macos-10.15'
304312

305313
# linux
306314
- name: Launch Bitrock installbuilder-20 with NO_CERT_INSTALL
307315
run: |
308-
${{ env.INSTALLBUILDER_PATH }} build installer.xml ${{ matrix.install-builder-name }} --verbose --license /tmp/license.xml --setvars ${{ env.INSTALLER_VARS }} ${{ env.NO_CERT_INSTALL }}
309-
cp -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CS.run ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-chrome.run
310-
mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CS.run ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-firefox.run
311-
cp -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-chrome.tar.gz
312-
mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}-installer-firefox.tar.gz
313-
if: matrix.operating-system == 'ubuntu-18.04'
316+
${{ env.INSTALLBUILDER_PATH }} build installer.xml linux-x64 --verbose --license /tmp/license.xml --setvars ${{ env.INSTALLER_VARS }} ${{ env.NO_CERT_INSTALL }}
317+
cp -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.run ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome.run
318+
mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.run ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox.run
319+
cp -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-chrome.tar.gz
320+
mv -v ArduinoCreateAgent-${GITHUB_REF##*/}-linux-x64-installer-CS.tar.gz ArduinoCreateAgent-${GITHUB_REF##*/}-${{ matrix.install-builder-name }}${{ matrix.arch }}-installer-firefox.tar.gz
321+
if: matrix.os == 'ubuntu-18.04'
314322

315323
- name: Upload artifacts
316324
uses: actions/upload-artifact@v2
@@ -322,22 +330,22 @@ jobs:
322330
# This job will sign and notarize mac installers
323331
code-sign-mac-installers:
324332
needs: package
325-
runs-on: macos-10.15
326-
327333
strategy:
328334
matrix:
329335
browser: [safari, firefox, chrome]
336+
arch: [-amd64]
330337

338+
runs-on: macos-10.15
331339
steps:
332340
- name: Download artifact
333341
uses: actions/download-artifact@v2
334342
with:
335-
name: ArduinoCreateAgent-osx
343+
name: ArduinoCreateAgent-osx${{ matrix.arch }}
336344
path: ArduinoCreateAgent-osx
337345

338346
# zip artifacts do not mantain executable permission
339347
- name: Make executable
340-
run: chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app/Contents/MacOS/*
348+
run: chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.app/Contents/MacOS/*
341349

342350
- name: Import Code-Signing Certificates
343351
run: |
@@ -357,33 +365,33 @@ jobs:
357365
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
358366
run: |
359367
cat > gon.config_installer.hcl <<EOF
360-
source = ["ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"]
368+
source = ["ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.app"]
361369
bundle_id = "cc.arduino.arduino-agent-installer"
362370
363371
sign {
364372
application_identity = "Developer ID Application: ARDUINO SA (7KT7ZWMCJT)"
365373
}
366374
367375
dmg {
368-
output_path = "ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.dmg"
376+
output_path = "ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.dmg"
369377
volume_name = "ArduinoCreateAgent"
370378
}
371379
EOF
372380
373381
- name: Code sign and notarize app
374382
run: |
375-
echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"
383+
echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.app"
376384
gon -log-level=debug -log-json gon.config_installer.hcl
377385
timeout-minutes: 30
378386

379387
# tar dmg file to keep executable permission
380388
- name: Tar files to keep permissions
381-
run: tar -cvf ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.tar ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.dmg
389+
run: tar -cvf ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.tar ArduinoCreateAgent-${GITHUB_REF##*/}-osx${{ matrix.arch }}-installer-${{ matrix.browser }}.dmg
382390

383391
- name: Upload artifacts
384392
uses: actions/upload-artifact@v2
385393
with:
386-
name: ArduinoCreateAgent-osx
394+
name: ArduinoCreateAgent-osx${{ matrix.arch }}
387395
path: ArduinoCreateAgent*.tar
388396
if-no-files-found: error
389397

@@ -407,9 +415,9 @@ jobs:
407415
- name: prepare artifacts for the release
408416
run: |
409417
mkdir release
410-
chmod -v +x ArduinoCreateAgent-linux-x64/*.run
411-
mv -v ArduinoCreateAgent-linux-x64/* release/
412-
cat ArduinoCreateAgent-osx/*.tar | tar -xvf - -i -C release/
418+
chmod -v +x ArduinoCreateAgent-linux-amd64/*.run
419+
mv -v ArduinoCreateAgent-linux-amd64/* release/
420+
cat ArduinoCreateAgent-osx-amd64/*.tar | tar -xvf - -i -C release/
413421
rm -v release/._ArduinoCreateAgent*.dmg
414422
mv -v ArduinoCreateAgent-windows*/* release/
415423
@@ -418,7 +426,7 @@ jobs:
418426
uses: crazy-max/ghaction-virustotal@v2
419427
with:
420428
vt_api_key: ${{ secrets.VIRUSTOTAL_API_KEY }}
421-
update_release_body: false # `true` won't work becasue trigger type is not release
429+
update_release_body: false # `true` won't work because trigger type is not release
422430
files: |
423431
release/*.exe
424432
arduino-create-agent-windows-2019-386/arduino-create-agent.exe
@@ -455,5 +463,11 @@ jobs:
455463
file: release/*
456464

457465
- name: Upload release files on Arduino downloads servers
458-
run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }} --include "*"
466+
run: aws s3 sync release/ s3://${{ secrets.DOWNLOADS_BUCKET }}${{ env.TARGET }}
467+
if: steps.prerelease.outputs.IS_PRE != 'true'
468+
469+
- name: Update version file (used by frontend to trigger autoupdate and create filename)
470+
run: |
471+
echo {\"Version\": \"${GITHUB_REF##*/}\"} > /tmp/agent-version.json
472+
aws s3 sync /tmp/agent-version.json s3://${{ env.VERSION_TARGET }}
459473
if: steps.prerelease.outputs.IS_PRE != 'true'

0 commit comments

Comments
 (0)