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/appsettings.json`);
|
||||||
files.push(`./${jobId}/webapi/client_secrets.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 => {
|
files.forEach(file => {
|
||||||
const data = require('fs').readFileSync(file, 'utf8');
|
const data = require('fs').readFileSync(file, 'utf8');
|
||||||
const regex = /#{(.*?)}/g;
|
const regex = /#{(.*?)}/g;
|
||||||
let match;
|
let match;
|
||||||
while (match = regex.exec(data)) {
|
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) {
|
function getValue(token) {
|
||||||
return 'TEST';
|
const secrets = json.parse(process.env.SECRETS);
|
||||||
|
return process.env[token] || secrets[token];
|
||||||
}
|
}
|
||||||
2
.github/workflows/release-morska.yml
vendored
2
.github/workflows/release-morska.yml
vendored
@@ -54,6 +54,8 @@ jobs:
|
|||||||
run: ls -laR ./${{env.job_id}}
|
run: ls -laR ./${{env.job_id}}
|
||||||
- name: Tokenize
|
- name: Tokenize
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v6
|
||||||
|
env:
|
||||||
|
SECRETS: ${{ toJson(secrets) }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const script = require('./.github/workflows/buildScripts/replaceTokens.js');
|
const script = require('./.github/workflows/buildScripts/replaceTokens.js');
|
||||||
|
|||||||
Reference in New Issue
Block a user