[MM-58065] Force the packager to create the version directory before packing (#3022) (#3023)

(cherry picked from commit e623fd1536)

Co-authored-by: Devin Binnie <52460000+devinbinnie@users.noreply.github.com>
This commit is contained in:
Mattermost Build 2024-04-30 22:58:26 +03:00 committed by GitHub
parent 47954e348e
commit a1244be5ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View file

@ -40,6 +40,7 @@
]
}
],
"beforePack": "scripts/beforepack.js",
"afterPack": "scripts/afterpack.js",
"afterAllArtifactBuild": "scripts/afterbuild.js",
"deb": {

14
scripts/beforepack.js Normal file
View file

@ -0,0 +1,14 @@
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
var fs = require('fs');
var path = require('path');
exports.default = async function beforePack(context) {
// The debian packager (fpm) complains when the directory to output the package to doesn't exist
// So we have to manually create it first
var dir = path.join(context.outDir, context.packager.appInfo.version)
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
};