Skip to content

Commit acf0aaa

Browse files
committed
move the bundle generation to a dedicated step:
This way we can notarize all the bundle and not only the binary.
1 parent 5920cb2 commit acf0aaa

File tree

1 file changed

+76
-39
lines changed

1 file changed

+76
-39
lines changed

.github/workflows/release.yml

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -149,22 +149,85 @@ jobs:
149149
config.ini
150150
if-no-files-found: error
151151

152-
# The code-sign-mac-executable job will download the macos artifact from the previous job, sign e notarize the binary and re-upload it.
153-
code-sign-mac-executable:
152+
create-macos-bundle:
154153
needs: build
155-
strategy:
156-
matrix: # to allow support for future architectures
157-
os: [macos-12]
158-
arch: [-amd64]
159154

160-
runs-on: ${{ matrix.os }}
155+
runs-on: macos-12
156+
env:
157+
EXE_PATH: "skel/ArduinoCreateAgent.app/Contents/MacOS/"
158+
159+
steps:
160+
- name: Checkout
161+
uses: actions/checkout@v3
162+
with:
163+
repository: 'bcmi-labs/arduino-create-agent-installer' # the repo which contains the bundle structure and icons
164+
token: ${{ secrets.ARDUINO_CREATE_AGENT_CI_PAT }}
165+
166+
- name: Download artifact
167+
uses: actions/download-artifact@v3
168+
with:
169+
name: ${{ env.PROJECT_NAME }}-macos-12-amd64
170+
path: ${{ env.EXE_PATH }}
171+
172+
- name: Remove placeholder file
173+
run: rm -rf ${{ env.EXE_PATH }}.empty
174+
175+
# zip artifacts do not mantain executable permission
176+
- name: Make executable
177+
run: chmod -v +x ${{ env.EXE_PATH }}${{ env.PROJECT_NAME }}
178+
179+
- name: Rename executable to Arduino_Create_Agent
180+
run: mv -v ${{ env.EXE_PATH }}${{ env.PROJECT_NAME }} ${{ env.EXE_PATH }}Arduino_Create_Agent
181+
182+
- name: get year
183+
run: echo "YEAR=$(date "+%Y")" >> $GITHUB_ENV
184+
185+
- name: Generate Info.plist for MacOS
186+
run: |
187+
cat > skel/ArduinoCreateAgent.app/Contents/Info.plist <<EOF
188+
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
189+
190+
<key>CFBundleIconFile</key> <string>AppIcon.icns</string>
191+
192+
<key>CFBundleName</key> <string>Arduino Create Agent</string>
193+
<key>CFBundleExecutable</key> <string>Arduino_Create_Agent</string>
194+
<key>CFBundleIdentifier</key> <string>create.arduino.cc</string>
195+
196+
<key>CFBundleVersion</key> <string>${GITHUB_REF##*/}</string>
197+
<key>NSHumanReadableCopyright</key> <string>© Copyright ${{ env.YEAR }} Arduino LLC</string>
198+
<key>CFBundleShortVersionString</key> <string>${GITHUB_REF##*/}</string>
199+
<key>LSUIElement</key> <true/>
200+
<!-- Needed for Apache Callback -->
201+
<key>NSPrincipalClass</key><string>NSApplication</string>
202+
<key>NSMainNibFile</key><string>MainMenu</string>
203+
204+
</dict></plist>
205+
EOF
206+
207+
- name: Tar bundle to keep permissions
208+
run: tar -cvf ArduinoCreateAgent.app.tar -C skel/ .
209+
210+
- name: Upload artifacts
211+
uses: actions/upload-artifact@v3
212+
with:
213+
if-no-files-found: error
214+
name: ArduinoCreateAgent.app
215+
path: ArduinoCreateAgent.app.tar
216+
217+
# The notarize-macos job will download the macos bundle from the previous job, sign, notarize and re-upload it.
218+
notarize-macos:
219+
name: Notarize bundle
220+
runs-on: macos-12
221+
needs: create-macos-bundle
161222

162223
steps:
163224
- name: Download artifact
164225
uses: actions/download-artifact@v3
165226
with:
166-
name: arduino-create-agent-${{ matrix.os }}${{ matrix.arch }}
167-
path: arduino-create-agent
227+
name: ArduinoCreateAgent.app
228+
229+
- name: un-Tar bundle
230+
run: tar -xvf ArduinoCreateAgent.app.tar
168231

169232
- name: Import Code-Signing Certificates
170233
run: |
@@ -195,7 +258,7 @@ jobs:
195258
run: |
196259
cat > "${{ env.GON_CONFIG_PATH }}" <<EOF
197260
# See: https://github.com/mitchellh/gon#configuration-file
198-
source = ["${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}"]
261+
source = ["ArduinoCreateAgent.app"]
199262
bundle_id = "cc.arduino.${{ env.PROJECT_NAME }}"
200263
201264
sign {
@@ -224,7 +287,7 @@ jobs:
224287

225288
# This job is responsible for generating the installers (using installbuilder)
226289
package:
227-
needs: code-sign-mac-executable
290+
needs: notarize-macos
228291
runs-on: ubuntu-20.04
229292

230293
env:
@@ -289,42 +352,16 @@ jobs:
289352
# zip artifacts do not mantain executable permission
290353
- name: Make executable
291354
run: chmod -v +x ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}*
292-
if: matrix.os == 'ubuntu-20.04' || matrix.os == 'macos-12'
355+
if: matrix.os == 'ubuntu-20.04'
293356

294357
- name: Rename executable to Arduino_Create_Agent
295358
run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent${{ matrix.extension }}
359+
if: matrix.os != 'macos-12'
296360

297361
- name: Rename executable to Arduino_Create_Agent_cli
298362
run: mv -v ${{ matrix.executable-path }}${{ env.PROJECT_NAME }}_cli${{ matrix.extension }} ${{ matrix.executable-path }}Arduino_Create_Agent_cli${{ matrix.extension }}
299363
if: matrix.os == 'ubuntu-20.04'
300364

301-
- name: get year
302-
run: echo "YEAR=$(date "+%Y")" >> $GITHUB_ENV
303-
if: matrix.os == 'macos-12'
304-
305-
- name: Generate Info.plist for MacOS
306-
run: |
307-
cat > skel/ArduinoCreateAgent.app/Contents/Info.plist <<EOF
308-
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>CFBundlePackageType</key><string>APPL</string><key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
309-
310-
<key>CFBundleIconFile</key> <string>AppIcon.icns</string>
311-
312-
<key>CFBundleName</key> <string>Arduino Create Agent</string>
313-
<key>CFBundleExecutable</key> <string>Arduino_Create_Agent</string>
314-
<key>CFBundleIdentifier</key> <string>create.arduino.cc</string>
315-
316-
<key>CFBundleVersion</key> <string>${GITHUB_REF##*/}</string>
317-
<key>NSHumanReadableCopyright</key> <string>© Copyright ${{ env.YEAR }} Arduino LLC</string>
318-
<key>CFBundleShortVersionString</key> <string>${GITHUB_REF##*/}</string>
319-
<key>LSUIElement</key> <true/>
320-
<!-- Needed for Apache Callback -->
321-
<key>NSPrincipalClass</key><string>NSApplication</string>
322-
<key>NSMainNibFile</key><string>MainMenu</string>
323-
324-
</dict></plist>
325-
EOF
326-
if: matrix.os == 'macos-12'
327-
328365
- name: Save InstallBuilder license to file
329366
run: echo "${{ secrets.INSTALLER_LICENSE }}" > /tmp/license.xml
330367

0 commit comments

Comments
 (0)