Skip to content

Commit 4ce859e

Browse files
committed
add comments
1 parent a9fb9c3 commit 4ce859e

File tree

1 file changed

+36
-27
lines changed

1 file changed

+36
-27
lines changed

.github/workflows/release.yml

+36-27
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
- zmoog/notarize
88

99
jobs:
10-
10+
# The build job is responsible for: configuring the environment, testing and compiling process
1111
build:
1212
strategy:
1313
matrix:
@@ -27,6 +27,7 @@ jobs:
2727
with:
2828
go-version: "1.15"
2929

30+
# dependencies used for compiling the GUI
3031
- name: Install Dependencies (Linux)
3132
run: sudo apt update && sudo apt install -y --no-install-recommends build-essential libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev
3233
if: matrix.operating-system == 'ubuntu-latest'
@@ -56,23 +57,28 @@ jobs:
5657
run: task build
5758
if: matrix.operating-system != 'windows-latest'
5859

60+
# build the agent without GUI support (no tray icon)
5961
- name: Build the Agent-cli
6062
run: task build-cli
6163
if: matrix.operating-system == 'ubuntu-latest'
6264

65+
# 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)
66+
# rsrc will produce *.syso files that should get automatically recognized by go build command and linked into an executable.
6367
- name: Embed manifest in win binary
6468
run: |
6569
go get github.com/akavel/rsrc
6670
rsrc -arch 386 -manifest manifest.xml
6771
if: matrix.operating-system == 'windows-latest'
6872

73+
# building the agent for win requires a different task because of an extra flag
6974
- name: Build the Agent for win32
7075
env:
71-
GOARCH: 386 # 32bit architecture
76+
GOARCH: 386 # 32bit architecture (for support)
7277
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)
7378
run: task build-win32
7479
if: matrix.operating-system == 'windows-latest'
7580

81+
# config.ini is required by the executable when it's run
7682
- name: Upload artifacts
7783
uses: actions/upload-artifact@v2
7884
with:
@@ -82,22 +88,19 @@ jobs:
8288
config.ini
8389
if-no-files-found: error
8490

85-
91+
# The code-sign-mac-executable job will download the macOS artifact from the previous job, sign e notarize the binary and re-upload it.
8692
code-sign-mac-executable:
8793
needs: build
8894
runs-on: macOS-latest
89-
env:
90-
INSTALLER_CERT_MAC_PASSWORD: ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
91-
INSTALLER_CERT_MAC_P12: "/tmp/ArduinoCerts2020.p12"
9295

9396
steps:
9497
- name: Checkout
9598
uses: actions/checkout@v2
9699
with:
97-
repository: 'bcmi-labs/arduino-create-agent-installer'
98-
token: ${{ secrets.PAT_TEMP }} # use token organization instead
100+
repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains gon.config.hcl
101+
token: ${{ secrets.PAT_TEMP }} # TODO use token organization instead
99102

100-
- name: Download artifacts
103+
- name: Download artifact
101104
uses: actions/download-artifact@v2
102105
with:
103106
name: arduino-create-agent-macOS-latest
@@ -117,39 +120,44 @@ jobs:
117120
brew install mitchellh/gon/gon
118121
119122
- name: Code sign and notarize app
123+
env:
124+
AC_USERNAME: ${{ secrets.AC_USERNAME }}
125+
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
120126
run: |
121127
gon -log-level=debug -log-json gon.config.hcl
122128
# gon will notarize ezecutable in "arduino-create-agent-macOS-latest/arduino-create-agent
123129
# The CI will ignore the zip output, using the signed binary only.
124-
env:
125-
AC_USERNAME: ${{ secrets.AC_USERNAME }}
126-
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
127130
128-
- name: Upload artifacts
131+
# This step will overwrite the non signed mac artifact (arduino-create-agent-macOS-latest)
132+
- name: Upload artifact
129133
uses: actions/upload-artifact@v2
130134
with:
131135
name: arduino-create-agent-macOS-latest
132136
path: arduino-create-agent-macOS-latest
133137
if-no-files-found: error
134138

139+
# This job is responsible for generating the installers (using installbuilder)
135140
package:
136141
needs: code-sign-mac-executable
137142
runs-on: ubuntu-latest
138143

139144
env:
145+
# vars used by installbuilder
140146
INSTALLER_VARS: "project.outputDirectory=$PWD project.version=${GITHUB_REF##*/} workspace=$PWD realname=Arduino_Create_Bridge"
147+
# vars passed to installbuilder to install https certs automatically
141148
CERT_INSTALL: "ask_certificates_install=CI" # win(edge),mac(safari)
142149
NO_CERT_INSTALL: "ask_certificates_install=CS" # linux
143150
CHOICE_CERT_INSTALL: "ask_certificates_install=CC" # win,mac:(ff,chrome)
144-
CREATE_OSX_BUNDLED_MG: 0 # do not create the DMG, gon will take care of that
151+
CREATE_OSX_BUNDLED_MG: 0 # tell installbuilder to not create the DMG, gon will take care of that later
152+
# installbuilder will read this vars automatically (defined in installer.xml):
145153
INSTALLER_CERT_WINDOWS_PASSWORD: ${{ secrets.INSTALLER_CERT_WINDOWS_PASSWORD }}
146154
INSTALLER_CERT_WINDOWS_PFX: "/tmp/ArduinoCerts2020.pfx"
147155
INSTALLER_CERT_MAC_PASSWORD: ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
148156
INSTALLER_CERT_MAC_P12: "/tmp/ArduinoCerts2020.p12"
149157

150158
strategy:
151159
fail-fast: false # if one os is failing continue nonetheless
152-
matrix:
160+
matrix: # used to generate installers for different OS and not for runs-on
153161
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
154162

155163
include:
@@ -176,15 +184,16 @@ jobs:
176184
- name: Checkout
177185
uses: actions/checkout@v2
178186
with:
179-
repository: 'bcmi-labs/arduino-create-agent-installer'
180-
token: ${{ secrets.PAT_TEMP }} # use token organization instead
187+
repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains install.xml
188+
token: ${{ secrets.PAT_TEMP }} # TODO use token organization instead
181189

182-
- name: Download artifacts
190+
- name: Download artifact
183191
uses: actions/download-artifact@v2
184192
with:
185193
name: arduino-create-agent-${{ matrix.operating-system }}
186-
path: ${{ matrix.executable-path }}
194+
path: ${{ matrix.executable-path }} # path expected by installbuilder
187195

196+
# zip artifacts do not mantain executable permission
188197
- name: Make executable
189198
run: chmod -v +x ${{ matrix.executable-path }}arduino-create-agent*
190199
if: matrix.operating-system == 'ubuntu-latest' || matrix.operating-system == 'macOS-latest'
@@ -236,25 +245,24 @@ jobs:
236245
path: ArduinoCreateAgent*
237246
if-no-files-found: error
238247

248+
# This job will sign and notarize mac installers
239249
code-sign-mac-installers:
240250
needs: package
241251
runs-on: macOS-latest
242-
env:
243-
INSTALLER_CERT_MAC_PASSWORD: ${{ secrets.INSTALLER_CERT_MAC_PASSWORD }}
244-
INSTALLER_CERT_MAC_P12: "/tmp/ArduinoCerts2020.p12"
245252

246253
strategy:
247254
matrix:
248255
browser: [safari, firefox, chrome]
249256

250257
steps:
251258

252-
- name: Download artifacts
259+
- name: Download artifact
253260
uses: actions/download-artifact@v2
254261
with:
255262
name: ArduinoCreateAgent-osx
256263
path: ArduinoCreateAgent-osx
257264

265+
# zip artifacts do not mantain executable permission
258266
- name: Make executable
259267
run: chmod -v +x ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app/Contents/MacOS/*
260268

@@ -272,7 +280,7 @@ jobs:
272280
brew install mitchellh/gon/gon
273281
274282
- name: Write gon config to file
275-
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
283+
# gon does not allow env variables in config file (https://github.com/mitchellh/gon/issues/20)
276284
run: |
277285
cat > gon.config_installer.hcl <<EOF
278286
source = ["ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"]
@@ -289,13 +297,14 @@ jobs:
289297
EOF
290298
291299
- name: Code sign and notarize app
292-
run: |
293-
echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"
294-
gon -log-level=debug -log-json gon.config_installer.hcl
295300
env:
296301
AC_USERNAME: ${{ secrets.AC_USERNAME }}
297302
AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
303+
run: |
304+
echo "gon will notarize executable in ArduinoCreateAgent-osx/ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.app"
305+
gon -log-level=debug -log-json gon.config_installer.hcl
298306
307+
# tar dmg file to keep executable permission
299308
- name: Tar files to keep permissions
300309
run: tar -cvf ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.tar ArduinoCreateAgent-${GITHUB_REF##*/}-osx-installer-${{ matrix.browser }}.dmg
301310

0 commit comments

Comments
 (0)