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

This commit is contained in:
Devin Binnie 2022-05-27 09:32:27 -04:00 committed by GitHub
parent 8979c18226
commit 42a53e31b5
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", "afterPack": "scripts/afterpack.js",
"afterSign": "scripts/notarize.js", "afterSign": "scripts/notarize.js",
"afterAllArtifactBuild": "scripts/afterbuild.js",
"deb": { "deb": {
"artifactName": "${version}/${name}_${version}-1_${arch}.${ext}", "artifactName": "${version}/${name}_${version}-1_${arch}.${ext}",
"synopsis": "Mattermost Desktop App", "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 #### Windows - setup exe files
$(print_link "${BASE_URL}/mattermost-desktop-setup-${VERSION}-win.exe") $(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 #### Mac
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-universal.dmg") $(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-universal.dmg")
$(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-x64.dmg") $(print_link "${BASE_URL}/mattermost-desktop-${VERSION}-mac-x64.dmg")

View file

@ -41,6 +41,12 @@ function checkWriteableApp() {
if (process.platform === 'win32') { if (process.platform === 'win32') {
try { try {
fs.accessSync(path.join(path.dirname(app.getAppPath()), '../../'), fs.constants.W_OK); 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) { } catch (error) {
log.info(`${app.getAppPath()}: ${error}`); log.info(`${app.getAppPath()}: ${error}`);
log.warn('autoupgrade disabled'); log.warn('autoupgrade disabled');