mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-15 13:51:20 +00:00
feat: add project versions (#110)
* refactor: allow version matrixes by projects * feat: add initial version-matrix for mage-os * feat: add project as optional input to action * docs: document new input * refactor: tighten types a bit * chore: apply change requests from code review
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
import { GithubActionsMatrix, MagentoMatrixVersion } from "./matrix-type";
|
||||
import compositeVersionJson from '../versions/composite.json';
|
||||
import individualVersionJson from '../versions/individual.json';
|
||||
|
||||
const knownVersions : Record<string, MagentoMatrixVersion> = {...individualVersionJson, ...compositeVersionJson };
|
||||
import { GithubActionsMatrix, PackageMatrixVersion } from "./matrix-type";
|
||||
import { getIndividualVersionsForProject, getCompositeVersionsForProject } from "../versions/get-versions-for-project";
|
||||
|
||||
/**
|
||||
* Computes the Github Actions Matrix for given versions of Magento
|
||||
* Computes the GitHub Actions Matrix for given versions of Magento
|
||||
*/
|
||||
export const getMatrixForVersions = (versions: string[]): GithubActionsMatrix => {
|
||||
export const getMatrixForVersions = (project: string, versions: string[]): GithubActionsMatrix => {
|
||||
const knownVersions : Record<string, PackageMatrixVersion> = {
|
||||
...getIndividualVersionsForProject(project), ...getCompositeVersionsForProject(project)
|
||||
}
|
||||
|
||||
return versions.reduce((acc, current): GithubActionsMatrix => {
|
||||
if(knownVersions[current] === undefined){
|
||||
throw new Error("Unknown version while computing matrix");
|
||||
if (knownVersions[current] === undefined){
|
||||
throw new Error(`Unknown "${current}" version while computing matrix`);
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user