Open guizmaii opened 2 years ago
Ok so, weirdly enough, the postMake
hook script that I developed with the help of @erickzhao to fix a AssertionError [ERR_ASSERTION]: Volume name is not longer than 27 chars
error explained here: https://discord.com/channels/745037351163527189/746375169240727755/968261323500711986 fixes the issue I was reporting here 🤷♂️
Good news 😄
Here's the postMake
hook script if you have one of these issues:
hooks: {
postMake: (forgeConfig, makeResults) => {
if (DEBUG_HOOKS) {
console.log("'forgeConfig': ", forgeConfig)
console.log("Initial 'makeResults': ", makeResults)
}
const isMacApp = makeResult => makeResult.platform === 'darwin'
const macBuilds = makeResults.filter(r => isMacApp(r))
if (macBuilds.length === 0) {
return makeResults
} else {
macBuilds.forEach(r => {
const newDmgName = `mycompany-myapp-${version}-${r.arch}`
const initialDmgName = 'mycompany-myapp'
r.packageJSON.name = newDmgName
const oldPath = r.artifacts[0]
r.artifacts[0] = r.artifacts[0].replace(`${initialDmgName}.dmg`, `${newDmgName}.dmg`)
const newPath = r.artifacts[0]
fs.renameSync(oldPath, newPath)
})
if (DEBUG_HOOKS) {
console.log("Final 'makeResults': ", makeResults)
}
return makeResults
}
},
},
to make this script work you need to have configured the @electron-forge/maker-dmg
this way:
{
name: '@electron-forge/maker-dmg',
config: {
background: './assets/icons/conduktor-icon.png',
format: 'ULFO',
icon: './assets/icons/conduktor-icon.png',
name: `mycompany-myapp`, // this `name` value needs to match the `initialDmgName` value in the the previous script
overwrite: true
}
},
Pre-flight checklist
Electron Forge version
6.0.0-beta.63
Electron version
v18.1.0
Operating system
macOS
Last known working Electron Forge version
No response
Expected behavior
Here's my
forge.config.js
:Here's my Github Action job that is publishing the app in "draft" mode:
As you can see in my CI definition, I publish my app for
Linux x64
,Windows x64
,macOS x64
andmacOS arm64
If I launch this job a first time with a version number that is not yet published, all the 4 apps will be correctly published.
My issue is that if I relaunch this job a second time with the same version number, then the Linux and Windows will be be published correctly while the 2 macOS versions will fail with the following error:
Expected behavior: The macOS versions are published too, overriding the previously published versions
Actual behavior
See "Expected behavior" part
Steps to reproduce
See "Expected behavior" part
Additional information
No response