WIP: Build & Release
This commit is contained in:
11
.github/workflows/buildScripts/replaceTokens.js
vendored
11
.github/workflows/buildScripts/replaceTokens.js
vendored
@@ -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];
|
||||
}
|
||||
Reference in New Issue
Block a user