Skip to content

Commit b9342bd

Browse files
authored
adding icon (#1571)
* adding icon as a workaround * point to an actual icon * include zap icon in the zip * fix path * PR review and verify zap.png
1 parent 973efe7 commit b9342bd

File tree

4 files changed

+109
-19
lines changed

4 files changed

+109
-19
lines changed

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,76 @@ jobs:
333333
- name: ZAP binary check (Linux) - unzip cleanup
334334
if: startsWith(matrix.os, 'ubuntu')
335335
run: rm -rf dist/zap-linux
336+
- name: Verify zap.png exists in package's base directory
337+
if: startsWith(matrix.os, 'ubuntu')
338+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
339+
with:
340+
command_line: ./node_modules/7zip-bin/linux/x64/7za l ./dist/zap-linux-x64.zip | grep zap.png
341+
contains: 'zap.png'
342+
343+
- name: Verify zap.png exists in package's app.asar archive
344+
if: startsWith(matrix.os, 'ubuntu')
345+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
346+
with:
347+
command_line: npx asar l ./dist/linux-unpacked/resources/app.asar | grep zap.png
348+
contains: 'zap.png'
349+
350+
- name: Verify zap.png exists in Windows x64 .zip package
351+
if: startsWith(matrix.os, 'macos')
352+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
353+
with:
354+
command_line: 7za l ./dist/zap-win-x64.zip | grep zap.png
355+
contains: 'zap.png'
356+
357+
- name: Verify zap.png exists in Windows x64 .zip package's app.asar archive
358+
if: startsWith(matrix.os, 'macos')
359+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
360+
with:
361+
command_line: npx asar l ./dist/win-unpacked/resources/app.asar | grep zap.png
362+
contains: 'zap.png'
363+
364+
- name: Verify zap.png exists in Windows arm64 .zip package
365+
if: startsWith(matrix.os, 'macos')
366+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
367+
with:
368+
command_line: 7za l ./dist/zap-win-arm64.zip | grep zap.png
369+
contains: 'zap.png'
370+
371+
- name: Verify zap.png exists in Windows arm64 .zip package's app.asar archive
372+
if: startsWith(matrix.os, 'macos')
373+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
374+
with:
375+
command_line: npx asar l ./dist/win-arm64-unpacked/resources/app.asar | grep zap.png
376+
contains: 'zap.png'
377+
378+
- name: Verify zap.png exists in macOS x64 .zip package
379+
if: startsWith(matrix.os, 'macos')
380+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
381+
with:
382+
command_line: 7za l ./dist/zap-mac-x64.zip | grep zap.png
383+
contains: 'zap.png'
384+
385+
- name: Verify zap.png exists in macOS x64 .zip package's app-x64.asar archive
386+
if: startsWith(matrix.os, 'macos')
387+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
388+
with:
389+
command_line: npx asar l ./dist/mac/zap.app/Contents/Resources/app-x64.asar | grep zap.png
390+
contains: 'zap.png'
391+
392+
- name: Verify zap.png exists in macOS arm64 .zip package
393+
if: startsWith(matrix.os, 'macos')
394+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
395+
with:
396+
command_line: 7za l ./dist/zap-mac-arm64.zip | grep zap.png
397+
contains: 'zap.png'
398+
399+
- name: Verify zap.png exists in macOS arm64 .zip package's app-arm64.asar archive
400+
if: startsWith(matrix.os, 'macos')
401+
uses: GuillaumeFalourd/assert-command-line-output@v2.1
402+
with:
403+
command_line: npx asar l ./dist/mac-arm64/zap.app/Contents/Resources/app-arm64.asar | grep zap.png
404+
contains: 'zap.png'
405+
336406
- name: Verify apack.json exists in package's base directory
337407
if: startsWith(matrix.os, 'ubuntu')
338408
uses: GuillaumeFalourd/assert-command-line-output@v2.1

apack.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"id": "ZAP",
5656
"category": "tools",
5757
"label": "ZCL Advanced Platform",
58+
"icon": "zap.png",
5859
"launchUiFunction": "launchZAP",
5960
"toolTip": "ZCL Advanced Platform"
6061
}

src-script/pack-apack-mac.js

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,48 @@ const sevenBin = require('7zip-bin')
55
const pathTo7zip = sevenBin.path7za
66

77
exports.default = async function (buildResult) {
8-
buildResult?.artifactPaths?.forEach((element) => {
8+
for (const element of buildResult?.artifactPaths || []) {
99
if (
1010
(element.includes('mac') ||
1111
element.includes('win') ||
1212
element.includes('linux')) &&
1313
element.endsWith('.zip')
1414
) {
15-
const myStream = Seven.add(
16-
element,
17-
path.join(buildResult.outDir, '../apack.json'),
18-
{
19-
$progress: true,
20-
$bin: pathTo7zip
21-
}
22-
)
23-
// myStream.on('end', function () {
24-
// console.log(myStream.info)
25-
// })
15+
// Add apack.json first
16+
await new Promise((resolve, reject) => {
17+
const myStream1 = Seven.add(
18+
element, // The .zip file (output)
19+
path.join(buildResult.outDir, '../apack.json'), // Add apack.json
20+
{
21+
$progress: true,
22+
$bin: pathTo7zip
23+
}
24+
)
2625

27-
myStream.on('error', function (err) {
28-
if (err) {
29-
console.log(err.stderr)
30-
throw err
31-
}
26+
myStream1.on('end', resolve)
27+
myStream1.on('error', (err) => {
28+
console.log('Error adding apack.json:', err.stderr)
29+
reject(err)
30+
})
31+
})
32+
33+
// Then add zap.png after apack.json is added
34+
await new Promise((resolve, reject) => {
35+
const myStream2 = Seven.add(
36+
element, // The .zip file (output)
37+
path.join(buildResult.outDir, '../src/assets/zap.png'), // Add zap.png
38+
{
39+
$progress: true,
40+
$bin: pathTo7zip
41+
}
42+
)
43+
44+
myStream2.on('end', resolve)
45+
myStream2.on('error', (err) => {
46+
console.log('Error adding zap.png:', err.stderr)
47+
reject(err)
48+
})
3249
})
3350
}
34-
})
51+
}
3552
}

src-script/pack-apack-win-linux.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ exports.default = async function (context) {
66
context.electronPlatformName === 'win32' ||
77
context.electronPlatformName === 'linux'
88
) {
9-
return scriptUtil.executeCmd({}, 'npx', [
9+
await scriptUtil.executeCmd({}, 'npx', [
1010
'copyfiles',
1111
'-V',
1212
'-f',
1313
path.resolve(context.outDir, '../apack.json'),
14+
path.resolve(context.outDir, '../src/assets/zap.png'),
1415
context.appOutDir
1516
])
17+
console.log('Files copied successfully.')
1618
}
1719
}

0 commit comments

Comments
 (0)