[MM-44344] Restore zip build for Windows and remove auto-updater from it (#2132) (#2140)

(cherry picked from commit 42a53e31b5)

Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
Mattermost Build 2022-05-27 16:32:42 +03:00 committed by GitHub
parent 51773679d1
commit c813a5203b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 0 deletions

View file

@ -38,6 +38,7 @@
],
"afterPack": "scripts/afterpack.js",
"afterSign": "scripts/notarize.js",
"afterAllArtifactBuild": "scripts/afterbuild.js",
"deb": {
"artifactName": "${version}/${name}_${version}-1_${arch}.${ext}",
"synopsis": "Mattermost Desktop App",

25
scripts/afterbuild.js Normal file
View file

@ -0,0 +1,25 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
const {spawnSync} = require('child_process');
const {path7za} = require('7zip-bin');
const windowsZipRegex = /win-[A-Za-z0-9]+\.zip$/g;
async function removeAppUpdate(path) {
const result = await spawnSync(path7za, ['d', path, 'resources/app-update.yml', '-r']);
if (result.error) {
throw new Error(
`Failed to remove files from ${path}: ${result.error} ${result.stderr} ${result.stdout}`,
);
}
}
exports.default = async function afterAllArtifactBuild(context) {
await context.artifactPaths.forEach(async (path) => {
if (path.match(windowsZipRegex)) {
await removeAppUpdate(path);
}
});
};

View file

@ -28,6 +28,10 @@ $(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-x86.msi")
#### Windows - setup exe files
$(print_link "${BASE_URL}/mattermost-desktop-setup-${VERSION}-win.exe")
#### Windows - zip files
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-win32.zip")
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-win64.zip")
#### Mac
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-universal.dmg")
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-x64.dmg")

View file

@ -41,6 +41,12 @@ function checkWriteableApp() {
if (process.platform === 'win32') {
try {
fs.accessSync(path.join(path.dirname(app.getAppPath()), '../../'), fs.constants.W_OK);
// check to make sure that app-update.yml exists
if (!fs.existsSync(path.join(process.resourcesPath, 'app-update.yml'))) {
log.warn('app-update.yml does not exist, disabling auto-updates');
return false;
}
} catch (error) {
log.info(`${app.getAppPath()}: ${error}`);
log.warn('autoupgrade disabled');