waveterm/buildres/deprecated/osx-sign.js
Evan Simkowitz 33fc3518c0
Sign and notarize directly in build-helper (#389)
* Sign and notarize in CI

* add dmg

* remove flag

* fix env var

* add team id

* conditionally set apple specific env vars

* publish to a staging location

* upload unzipped

* add script to publish to staging, update publish url

* turn off autodiscovery again

* update scripts

* deprecate old method

* move stuff

* remove autodiscovery
2024-03-06 16:07:48 -08:00

46 lines
1.3 KiB
JavaScript

// Sign the app and binaries for macOS
const { signAsync } = require("@electron/osx-sign");
const path = require("path");
const fs = require("fs");
/**
* Sign the app and binaries for macOS
* @param {string} waveAppPath - Path to the Wave.app
* @returns {Promise<void>}
*/
async function signApp(waveAppPath) {
const binDirPath = path.resolve(waveAppPath, "Contents", "Resources", "app.asar.unpacked", "bin");
const binFilePaths = fs
.readdirSync(binDirPath, { recursive: true, withFileTypes: true })
.filter((f) => f.isFile())
.map((f) => path.resolve(binDirPath, f.path, f.name));
console.log("waveAppPath", waveAppPath);
console.log("binDirPath", binDirPath);
console.log("binFilePaths", binFilePaths);
return signAsync({
app: waveAppPath,
binaries: binFilePaths,
})
.then(() => {
console.log("signing success");
})
.catch((e) => {
console.log("signing error", e);
process.exit(1);
});
}
if (require.main === module) {
console.log("running osx-sign");
const waveAppPath = path.resolve(__dirname, "temp", "Wave.app");
(async () => {
await signApp(waveAppPath);
console.log("signing complete");
})();
}
module.exports = {
signApp,
};