mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-15 05:51:20 +00:00
f7f0504691
* 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
34 lines
1.1 KiB
TypeScript
34 lines
1.1 KiB
TypeScript
import { validateProject } from "../project/validate-projects";
|
|
import { PackageMatrixVersion } from "../matrix/matrix-type";
|
|
|
|
const individual = {
|
|
'mage-os': require('./mage-os/individual.json'),
|
|
'magento-open-source': require('./magento-open-source/individual.json')
|
|
}
|
|
|
|
const composite = {
|
|
'mage-os': require('./mage-os/composite.json'),
|
|
'magento-open-source': require('./magento-open-source/composite.json')
|
|
}
|
|
|
|
export const getIndividualVersionsForProject = (project: string): Record<string, PackageMatrixVersion> => {
|
|
validateProject(<any>project)
|
|
if (individual[project] === undefined) {
|
|
throw new Error(
|
|
`Project "${project}" has no individual version specifications`
|
|
)
|
|
}
|
|
|
|
return individual[project]
|
|
}
|
|
|
|
export const getCompositeVersionsForProject = (project: string): Record<string, PackageMatrixVersion> => {
|
|
validateProject(<any>project)
|
|
if (composite[project] === undefined) {
|
|
throw new Error(
|
|
`Project "${project}" has no composite version specifications`
|
|
)
|
|
}
|
|
|
|
return composite[project]
|
|
} |