-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Uroš Marolt
committed
Jan 9, 2024
1 parent
6ffb59c
commit ca768fb
Showing
4 changed files
with
226 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,40 @@ | ||
import * as exec from '@actions/exec' | ||
import dotenv from 'dotenv' | ||
import { IBuilderDefinition } from './types' | ||
import fs from 'fs' | ||
|
||
export const loadBuilderDefinitions = async (): Promise<IBuilderDefinition[]> => { | ||
const results: IBuilderDefinition[] = [] | ||
const files = fs.readdirSync('./scripts/builders') | ||
|
||
for (const result of files) { | ||
if (result.endsWith('.env')) { | ||
const content = fs.readFileSync(`./scripts/builders/${result}`, 'utf-8') | ||
const parsed = dotenv.parse(content) | ||
|
||
const imageName = result.split('.env')[0] | ||
const dockerRepository = parsed.REPO | ||
let services: string[] = [] | ||
if (parsed.SERVICES !== undefined) { | ||
services = parsed.SERVICES.split(' ') | ||
.map((s) => s.trim()) | ||
.filter((s) => s.length > 0) | ||
} | ||
|
||
let prioritizedServices: string[] = [] | ||
if (parsed.PRIORITIZED !== undefined) { | ||
prioritizedServices = parsed.PRIORITIZED.split(' ') | ||
.map((s) => s.trim()) | ||
.filter((s) => s.length > 0) | ||
} | ||
|
||
results.push({ | ||
imageName, | ||
dockerRepository, | ||
services, | ||
prioritizedServices, | ||
}) | ||
} | ||
} | ||
|
||
return results | ||
} |