Generate supported channels yml files for all builds (#1914)

This commit is contained in:
Salah Benmoussati 2023-07-27 12:25:59 +02:00 committed by GitHub
parent a0a37b0e55
commit 5e10ab3fdd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 4 deletions

View File

@ -1,7 +1,5 @@
const path = require('path');
const fs = require('fs');
const crypto = require('crypto');
const yaml = require('js-yaml');
const INSTALLERS_URL = 'https://static.symphony.com/sda/';
@ -13,7 +11,17 @@ function updateYamlFile(yamlFilePath) {
fs.writeFileSync(yamlFilePath, yaml.dump(doc, { lineWidth: -1 }));
}
function generateChannelsFiles(srcFile) {
// "latest" channel is already created so we need to generate stable, beta and daily
const targetedAutoUpdateChannels = ['stable', 'beta', 'daily'];
for (const channel of targetedAutoUpdateChannels) {
const updatedFileName = srcFile.replace('latest', channel);
fs.copyFileSync(srcFile, updatedFileName);
}
}
(async () => {
const yamlFilePath = process.argv[2];
updateYamlFile(yamlFilePath);
generateChannelsFiles(yamlFilePath);
})();

View File

@ -16,7 +16,20 @@ function updateYamlFile(yamlFilePath, installerHash) {
fs.writeFileSync(yamlFilePath, yaml.dump(doc, { lineWidth: -1 }));
}
function getHashFile(
function generateChannelsFiles(srcFile) {
// "latest" channel is already created so we need to generate stable, beta and daily
const targetedAutoUpdateChannels = ['stable', 'beta', 'iv', 'daily'];
for (const channel of targetedAutoUpdateChannels) {
const updatedFileName = srcFile.replace('latest', channel);
fs.copyFileSync(
yamlFilePath,
updatedFileName,
fs.constants.COPYFILE_FICLONE_FORCE,
);
}
}
function updateHash(
file,
yamlFilePath,
algorithm = 'sha512',
@ -50,5 +63,6 @@ function getHashFile(
(async () => {
const installerPath = process.argv[2];
const yamlFilePath = process.argv[3];
await getHashFile(installerPath, yamlFilePath);
await updateHash(installerPath, yamlFilePath);
generateChannelsFiles(yamlFilePath);
})();