Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: macos package signing build #25

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 17 additions & 32 deletions forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AutoUnpackNativesPlugin } from '@electron-forge/plugin-auto-unpack-nati
import { WebpackPlugin } from '@electron-forge/plugin-webpack';
import { PublisherGithub } from '@electron-forge/publisher-github';
import fs from 'fs';
import path from 'path';
import { exec } from 'child_process';

import { mainConfig, mainDevConfig } from './webpack.main.config';
Expand All @@ -18,7 +17,7 @@ const config: ForgeConfig = {
packagerConfig: {
asar: true,
name: 'morpheus',
extraResource: ['./src/executables/'],
extraResource: ['./executables/'],
icon: 'src/frontend/assets/images/circle-mor-logo',
osxSign: {
identity: process.env.APPLE_DEVELOPER_ID,
Expand All @@ -31,40 +30,34 @@ const config: ForgeConfig = {
...(process.env.APPLE_ID &&
process.env.APPLE_ID_PASSWORD &&
process.env.APPLE_TEAM_ID && {
osxNotarize: {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
}),
osxNotarize: {
appleId: process.env.APPLE_ID,
appleIdPassword: process.env.APPLE_ID_PASSWORD,
teamId: process.env.APPLE_TEAM_ID,
},
}),
},
hooks: {
postPackage: async (_, { platform, outputPaths }) => {
prePackage: async (_, platform) => {
const platformFile =
platform === 'darwin'
? 'ollama-darwin'
: platform === 'win32'
? 'ollama.exe'
: 'ollama-linux';

const outputResourceFolder = `${outputPaths[0]}${platform === 'darwin' ? '/morpheus.app/Contents' : ''}/resources/executables/`;

fs.readdir(outputResourceFolder, (err, files) => {
if (err) {
throw err;
}
const filePath = `src/executables/${platformFile}`;

files.forEach((file) => {
const localPath = path.join(outputResourceFolder, file);
platform !== 'win32'
? exec(`chmod +x ${filePath}`)
: fs.chmodSync(filePath, 755);

if (file !== platformFile) {
//fs.unlinkSync(localPath);
} else {
platform !== 'win32' ? exec(`chmod +x ${localPath}`) : fs.chmodSync(localPath, 755);
}
});
});
fs.mkdirSync('executables');
fs.copyFileSync(filePath, `executables/${platformFile}`);
},
postPackage: async () => {
fs.rmSync('executables', { recursive: true, force: true });
}
},
rebuildConfig: {},
makers: [
Expand Down Expand Up @@ -94,14 +87,6 @@ const config: ForgeConfig = {
},
},
},
// contents: [
// {
// x: 410,
// y: 220,
// type: 'link',
// path: '/Applications',
// },
// ],
}),
],
publishers: [
Expand Down
Loading