waveterm/buildres/update-latest-mac.js
Evan Simkowitz 4ef921bdd1
Support Linux packaging via electron-builder (#371)
* Add linux makers

* missed some

* remove eu-strip

* blah

* add description

* remove v from version

* add exec name

* use bin

* add bin to both

* test flatpak

* test adding dev dependencies

* remove flatpak for now

* add command to flatten directory structure

* update package info

* save rpm info

* save work

* add bin to packagerConfig

* save work

* okay let's see what happens

* iterate array

* test more

* remove large

* test

* test

* remove linux arm

* test addl targets

* add quiet to zip

* revert dir flatten

* remove pacman

* add s3 bucket to electron-builder config

* make dir

* only copy artifacts

* don't merge

* zip recurse

* blah

* replace with electronupdater

* make generic

* fix

* fix stuff

* Update build-helper.yml

* test fix

* fix path

* remove tree

* messed up comment

* remove touch

* add platform name to artifact

* remove license

* remove forge

* cleanup builder config

* switch artifact name order

* Remove darwin restriction on autoupdate

* try adding back pacman

* fix license

* remove pacman again

* rewrite scripts

* add binary paths to builder

* clean up

* Update scripts

* update interval and readme

* remove flatpak and snap dependencies for now

* upload with a wildcard

* fix paths for addl binaries

* add back blockmap

* update release path

* add newline

* remove forge config

* 2 small fixes - remove double cd for waveshell building, and remove GOARCH for wavesrv binary in dev mode
2024-03-04 22:03:53 -08:00

41 lines
1.3 KiB
JavaScript

// Updates the latest-mac.yml file with the signed and notarized version of the latest installer
// Usage: node update-latest.js <path-to-installer>
const path = require("path");
const fs = require("fs");
const { hashFile } = require("./generate-hash");
const yaml = require("yaml");
/**
* Updates the latest-mac.yml file with the signed and notarized version of the latest installer
* @param {string} installerPath - Path to the installer
* @param {string} ymlPath - Path to the latest-mac.yml file
* @returns {Promise<void>}
*/
async function updateLatestMac(installerPath, ymlPath) {
const hash = (await hashFile(installerPath)).trim();
const size = fs.statSync(installerPath).size;
const yml = yaml.parse(fs.readFileSync(ymlPath, "utf8"));
for (const file of yml.files) {
if (file.url === path.basename(installerPath)) {
file.sha512 = hash;
file.size = size;
}
}
yml.sha512 = hash;
fs.writeFileSync(ymlPath, yaml.stringify(yml));
}
if (require.main === module) {
const installerPath = path.resolve(process.cwd(), process.argv[2]);
const ymlPath = path.resolve(process.cwd(), process.argv[3]);
(async () => {
await updateLatestMac(installerPath, ymlPath);
console.log("latest-mac.yml updated");
})();
}
module.exports = {
updateLatestMac,
};