mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-13 13:14:53 +00:00
feat(supported-version): add service_preferences and support for php-fpm and nginx (#255)
This commit is contained in:
@@ -3,6 +3,7 @@ import { validateKind } from './kind/validate-kinds';
|
||||
import { getMatrixForKind } from './matrix/get-matrix-for-kind';
|
||||
import { validateProject } from "./project/validate-projects";
|
||||
import { buildServicesForEntry } from "./services/build-services";
|
||||
import { parseServicePreferences, validatePreferencesAgainstMatrix } from "./services/preferences";
|
||||
|
||||
|
||||
export async function run(): Promise<void> {
|
||||
@@ -12,19 +13,33 @@ export async function run(): Promise<void> {
|
||||
const project = core.getInput("project");
|
||||
const recent_time_frame = core.getInput("recent_time_frame");
|
||||
const include_services = core.getInput("include_services") === "true";
|
||||
const service_preferences_raw = core.getInput("service_preferences");
|
||||
|
||||
validateProject(<any>project)
|
||||
|
||||
validateKind(<any>kind, customVersions ? customVersions.split(',') : undefined);
|
||||
|
||||
const preferences = parseServicePreferences(service_preferences_raw);
|
||||
const hasPreferences = Object.keys(preferences).length > 0;
|
||||
|
||||
if (!include_services && hasPreferences) {
|
||||
throw new Error(
|
||||
'service_preferences cannot be combined with include_services: false. Set include_services: true or clear service_preferences.'
|
||||
);
|
||||
}
|
||||
|
||||
let matrix = getMatrixForKind(kind, project, customVersions, recent_time_frame);
|
||||
|
||||
if (include_services) {
|
||||
if (hasPreferences) {
|
||||
validatePreferencesAgainstMatrix(preferences, matrix.include);
|
||||
}
|
||||
const workspace = process.env.GITHUB_WORKSPACE || '';
|
||||
matrix = {
|
||||
magento: matrix.magento,
|
||||
include: matrix.include.map((entry) => ({
|
||||
...entry,
|
||||
services: buildServicesForEntry(entry)
|
||||
services: buildServicesForEntry(entry, preferences, workspace)
|
||||
}))
|
||||
};
|
||||
}
|
||||
@@ -36,4 +51,4 @@ export async function run(): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
run()
|
||||
run()
|
||||
|
||||
Reference in New Issue
Block a user