WIP: Build & Release

This commit is contained in:
Michał Zieliński
2025-02-12 17:45:01 +01:00
parent 2739f07c9b
commit 5db6f6c629
2 changed files with 8 additions and 5 deletions

View File

@@ -11,19 +11,20 @@ module.exports = async ({ github, context, core, jobId }) => {
files.push(`./${jobId}/webapi/appsettings.json`);
files.push(`./${jobId}/webapi/client_secrets.json`);
// tokens are in format #{tokenName} find all tokens and replace it with getValue(tokenName)
const tokens = [];
files.forEach(file => {
const data = require('fs').readFileSync(file, 'utf8');
const regex = /#{(.*?)}/g;
let match;
while (match = regex.exec(data)) {
tokens.push(match[1]);
const token = match[1].replace(/-/g, '_').toUpperCase();
console.log(token);
const value = getValue(token);
console.log(value);
}
});
console.log(tokens);
}
function getValue(token) {
return 'TEST';
const secrets = json.parse(process.env.SECRETS);
return process.env[token] || secrets[token];
}