This commit is contained in:
Jan Prochazka
2024-12-28 15:10:45 +01:00
parent 2f8c584af5
commit 6c9b738717
2 changed files with 12 additions and 6 deletions

View File

@@ -1,7 +1,6 @@
const fs = require('fs'); const fs = require('fs');
const path = require('path'); const path = require('path');
const yaml = require('js-yaml'); const yaml = require('js-yaml');
const rimraf = require('rimraf');
const _ = require('lodash'); const _ = require('lodash');
const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates')); const indir = path.resolve(path.join(__dirname, '..', 'workflow-templates'));
@@ -34,7 +33,7 @@ function conditionMatch(condition, args) {
} }
function processJsonStep(json, args) { function processJsonStep(json, args) {
return _.cloneDeepWith(value, x => { return _.cloneDeepWith(json, value => {
if (_.isArray(value)) { if (_.isArray(value)) {
const res = []; const res = [];
for (const item of value) { for (const item of value) {
@@ -71,7 +70,7 @@ function processJsonStep(json, args) {
} }
if (_.isPlainObject(value)) { if (_.isPlainObject(value)) {
if (_.intersection(args.allNames ?? [], Object.keys(values))?.length > 0) { if (_.intersection(args.allNames ?? [], Object.keys(value))?.length > 0) {
modified = true; modified = true;
return value[args.name]; return value[args.name];
} }
@@ -118,8 +117,15 @@ function processFiles() {
} }
} }
async function run() { function deleteOldFiles() {
await new Promise(resolve => rimraf(outdir, resolve)); const files = fs.readdirSync(outdir);
for (const file of files) {
fs.unlink(path.join(outdir, file));
}
}
function run() {
deleteOldFiles();
readIncludes(); readIncludes();
processFiles(); processFiles();
} }

View File

@@ -21,7 +21,7 @@ on:
tags: tags:
- 'v[0-9]+.[0-9]+.[0-9]+' - 'v[0-9]+.[0-9]+.[0-9]+'
- _community: 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' - _community: 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
_premium: - 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+' _premium: 'v[0-9]+.[0-9]+.[0-9]+-premium-beta.[0-9]+'
jobs: jobs:
build: build: