mirror of
https://gitlab.com/futo-org/fcast.git
synced 2025-06-24 21:25:23 +00:00
Mac CI fixes
This commit is contained in:
parent
090a13ea67
commit
516cc1c391
1 changed files with 35 additions and 9 deletions
|
@ -1,6 +1,8 @@
|
|||
const fs = require('fs');
|
||||
const yargs = require('yargs/yargs');
|
||||
const { hideBin } = require('yargs/helpers');
|
||||
const { exec } = require('child_process');
|
||||
const path = require('path');
|
||||
const extract = require('extract-zip')
|
||||
|
||||
const { FusesPlugin } = require('@electron-forge/plugin-fuses');
|
||||
|
@ -50,14 +52,14 @@ module.exports = {
|
|||
},
|
||||
background: './assets/images/background.png',
|
||||
contents: [
|
||||
{ 'x': 90, 'y': 350, 'type': 'file', 'path': `out/${APPLICATION_NAME}-darwin-${argv.arch}/${APPLICATION_NAME}.app` },
|
||||
{ 'x': 360, 'y': 350, 'type': 'link', 'path': '/Applications' },
|
||||
{ 'x': 190, 'y': 350, 'type': 'file', 'path': `out/${APPLICATION_NAME}-darwin-${argv.arch}/${APPLICATION_TITLE}.app` },
|
||||
{ 'x': 460, 'y': 350, 'type': 'link', 'path': '/Applications' },
|
||||
{ 'x': 0, 'y': 540, 'type': 'position', 'path': '.background' },
|
||||
{ 'x': 120, 'y': 540, 'type': 'position', 'path': '.VolumeIcon.icns' }
|
||||
],
|
||||
format: 'ULFO',
|
||||
icon: './assets/icons/icon.icns',
|
||||
name: APPLICATION_NAME
|
||||
name: APPLICATION_TITLE
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -86,10 +88,25 @@ module.exports = {
|
|||
},
|
||||
{
|
||||
name: '@electron-forge/maker-zip',
|
||||
// Manually creating zip for mac targets due to .app renaming
|
||||
platforms: ["win32", "linux"],
|
||||
config: {}
|
||||
},
|
||||
],
|
||||
hooks: {
|
||||
postPackage: async (config, packageResults) => {
|
||||
switch (packageResults.platform) {
|
||||
case "darwin": {
|
||||
let artifactName = `${APPLICATION_NAME}.app`;
|
||||
if (fs.existsSync(`./out/${APPLICATION_NAME}-${packageResults.platform}-${packageResults.arch}/${artifactName}`)) {
|
||||
fs.renameSync(`./out/${APPLICATION_NAME}-${packageResults.platform}-${packageResults.arch}/${artifactName}`, `./out/${APPLICATION_NAME}-${packageResults.platform}-${packageResults.arch}/${APPLICATION_TITLE}.app`);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
postMake: async (forgeConfig, makeResults) => {
|
||||
for (const e of makeResults) {
|
||||
// Standardize artifact output naming
|
||||
|
@ -108,15 +125,17 @@ module.exports = {
|
|||
break;
|
||||
}
|
||||
case "darwin": {
|
||||
let artifactName = `${APPLICATION_NAME}.dmg`;
|
||||
let artifactName = `${APPLICATION_TITLE}.dmg`;
|
||||
if (fs.existsSync(`./out/make/${artifactName}`)) {
|
||||
fs.renameSync(`./out/make/${artifactName}`, `./out/make/FCast-Receiver-${e.packageJSON.version}-macOS-${e.arch}.dmg`);
|
||||
fs.renameSync(`./out/make/${artifactName}`, `./out/make/${APPLICATION_NAME}-${e.packageJSON.version}-macOS-${e.arch}.dmg`);
|
||||
}
|
||||
|
||||
artifactName = `${APPLICATION_NAME}-darwin-${e.arch}-${e.packageJSON.version}.zip`;
|
||||
if (fs.existsSync(`./out/make/zip/darwin/${e.arch}/${artifactName}`)) {
|
||||
fs.renameSync(`./out/make/zip/darwin/${e.arch}/${artifactName}`, `./out/make/zip/darwin/${e.arch}/FCast-Receiver-${e.packageJSON.version}-macOS-${e.arch}.zip`);
|
||||
}
|
||||
console.log(`Making a zip distributable for ${e.platform}/${e.arch}`);
|
||||
const zipName = `${APPLICATION_NAME}-${e.packageJSON.version}-macOS-${e.arch}.zip`;
|
||||
const zipPath = path.resolve(process.cwd(), 'out', 'make', 'zip', e.platform, e.arch, zipName);
|
||||
|
||||
exec(`mkdir -p ${path.dirname(zipPath)}`, execOutput);
|
||||
exec(`cd out/${APPLICATION_NAME}-${e.platform}-${e.arch}; zip -r -y "${zipPath}" "${APPLICATION_TITLE}.app"`, execOutput);
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -176,3 +195,10 @@ module.exports = {
|
|||
}),
|
||||
],
|
||||
};
|
||||
|
||||
function execOutput(err, stdout, stderr) {
|
||||
if (err) {
|
||||
console.log(stderr);
|
||||
}
|
||||
console.log(stdout);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue