WIP: Build & Release
This commit is contained in:
12
.github/workflows/buildScripts/replaceTokens.js
vendored
12
.github/workflows/buildScripts/replaceTokens.js
vendored
@@ -1,4 +1,5 @@
|
||||
module.exports = async ({ github, context, core, jobId }) => {
|
||||
/*
|
||||
const frontendPath = `./${jobId}/frontend/diunaBI/browser/`;
|
||||
const files = (require('fs').readdirSync(frontendPath).filter(file => file.endsWith('.js')))
|
||||
.map(file => `${frontendPath}${file}`);
|
||||
@@ -6,13 +7,14 @@ module.exports = async ({ github, context, core, jobId }) => {
|
||||
core.setFailed("Frontend JS files not found");
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
files.push(`./${jobId}/webapi/appsettings.json`);
|
||||
files.push(`./${jobId}/webapi/client_secrets.json`);
|
||||
//files.push(`./${jobId}/webapi/client_secrets.json`);
|
||||
|
||||
files.forEach(file => {
|
||||
const data = require('fs').readFileSync(file, 'utf8');
|
||||
let data = require('fs').readFileSync(file, 'utf8');
|
||||
const regex = /#{(.*?)}/g;
|
||||
let match;
|
||||
while (match = regex.exec(data)) {
|
||||
@@ -23,9 +25,11 @@ module.exports = async ({ github, context, core, jobId }) => {
|
||||
core.setFailed(`Token ${token} not found`);
|
||||
return false;
|
||||
}
|
||||
const result = data.replace(new RegExp(`#{${original}}`, 'g'), value);
|
||||
require('fs').writeFileSync(file, result, 'utf8');
|
||||
data = data.replace(new RegExp(`#{${original}}`, 'g'), value);
|
||||
console.log(`Replaced ${original} with ${value} (${token}) in ${file}`);
|
||||
}
|
||||
console.log(data);
|
||||
require('fs').writeFileSync(file, data, 'utf8');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user