From 3bca12fd4a337b6dabc2398db91c5b4c88425d03 Mon Sep 17 00:00:00 2001 From: Alice <53339016+AliceHincu@users.noreply.github.com> Date: Sat, 31 Aug 2024 17:42:07 +0300 Subject: [PATCH] Desktop: Seamless-Updates: added latest-mac-arm64.yml (#10941) --- .github/workflows/build-macos-m1.yml | 2 +- ...rateSha512.js => afterAllArtifactBuild.js} | 11 +++++--- .../app-desktop/artifactBuildCompleted.js | 25 +++++++++++++++++++ packages/app-desktop/package.json | 2 +- 4 files changed, 35 insertions(+), 5 deletions(-) rename packages/app-desktop/{generateSha512.js => afterAllArtifactBuild.js} (84%) create mode 100644 packages/app-desktop/artifactBuildCompleted.js diff --git a/.github/workflows/build-macos-m1.yml b/.github/workflows/build-macos-m1.yml index 0608c2e23ac..38c857a64f6 100644 --- a/.github/workflows/build-macos-m1.yml +++ b/.github/workflows/build-macos-m1.yml @@ -83,4 +83,4 @@ jobs: npm pkg set 'build.mac.identity'=null --json PYTHON_PATH=$(which python) USE_HARD_LINKS=false yarn dist --mac --arm64 --publish=never - fi + fi \ No newline at end of file diff --git a/packages/app-desktop/generateSha512.js b/packages/app-desktop/afterAllArtifactBuild.js similarity index 84% rename from packages/app-desktop/generateSha512.js rename to packages/app-desktop/afterAllArtifactBuild.js index 17f3748ae30..4f6fb670f1e 100644 --- a/packages/app-desktop/generateSha512.js +++ b/packages/app-desktop/afterAllArtifactBuild.js @@ -2,13 +2,14 @@ const fs = require('fs'); const path = require('path'); const os = require('os'); const sha512 = require('js-sha512'); +const distDirName = 'dist'; +const distPath = path.join(__dirname, distDirName); const generateChecksumFile = () => { if (os.platform() !== 'linux') { return []; // SHA-512 is only for AppImage } - const distDirName = 'dist'; - const distPath = path.join(__dirname, distDirName); + let appImageName = ''; const files = fs.readdirSync(distPath); for (const key in files) { @@ -30,4 +31,8 @@ const generateChecksumFile = () => { return [sha512FilePath]; }; -exports.default = generateChecksumFile; +const mainHook = () => { + generateChecksumFile(); +}; + +exports.default = mainHook; diff --git a/packages/app-desktop/artifactBuildCompleted.js b/packages/app-desktop/artifactBuildCompleted.js new file mode 100644 index 00000000000..03d23075a42 --- /dev/null +++ b/packages/app-desktop/artifactBuildCompleted.js @@ -0,0 +1,25 @@ +const fs = require('fs'); +const path = require('path'); +const os = require('os'); +const distDirName = 'dist'; +const distPath = path.join(__dirname, distDirName); + +const renameLatestYmlFile = () => { + if (os.platform() === 'darwin' && process.arch === 'arm64') { + const latestMacFilePath = path.join(distPath, 'latest-mac.yml'); + const renamedMacFilePath = path.join(distPath, 'latest-mac-arm64.yml'); + + if (fs.existsSync(latestMacFilePath)) { + fs.renameSync(latestMacFilePath, renamedMacFilePath); + return [renamedMacFilePath]; + } else { + throw new Error('latest-mac.yml not found!'); + } + } +}; + +const mainHook = () => { + renameLatestYmlFile(); +}; + +exports.default = mainHook; diff --git a/packages/app-desktop/package.json b/packages/app-desktop/package.json index 6ba110acee6..978e0d50395 100644 --- a/packages/app-desktop/package.json +++ b/packages/app-desktop/package.json @@ -41,7 +41,7 @@ "build/tesseract.js-core/**", "build/7zip/**" ], - "afterAllArtifactBuild": "./generateSha512.js", + "afterAllArtifactBuild": "./afterAllArtifactBuild.js", "asar": true, "asarUnpack": "./node_modules/node-notifier/vendor/**", "win": {