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
2 changed files with 26 additions and 4 deletions

View File

@@ -1,7 +1,5 @@
const path = require('path'); const path = require('path');
const fs = require('fs'); const fs = require('fs');
const crypto = require('crypto');
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const INSTALLERS_URL = 'https://static.symphony.com/sda/'; const INSTALLERS_URL = 'https://static.symphony.com/sda/';
@@ -13,7 +11,17 @@ function updateYamlFile(yamlFilePath) {
fs.writeFileSync(yamlFilePath, yaml.dump(doc, { lineWidth: -1 })); 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 () => { (async () => {
const yamlFilePath = process.argv[2]; const yamlFilePath = process.argv[2];
updateYamlFile(yamlFilePath); updateYamlFile(yamlFilePath);
generateChannelsFiles(yamlFilePath);
})(); })();

View File

@@ -16,7 +16,20 @@ function updateYamlFile(yamlFilePath, installerHash) {
fs.writeFileSync(yamlFilePath, yaml.dump(doc, { lineWidth: -1 })); 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, file,
yamlFilePath, yamlFilePath,
algorithm = 'sha512', algorithm = 'sha512',
@@ -50,5 +63,6 @@ function getHashFile(
(async () => { (async () => {
const installerPath = process.argv[2]; const installerPath = process.argv[2];
const yamlFilePath = process.argv[3]; const yamlFilePath = process.argv[3];
await getHashFile(installerPath, yamlFilePath); await updateHash(installerPath, yamlFilePath);
generateChannelsFiles(yamlFilePath);
})(); })();