mirror of
https://github.com/graycoreio/github-actions-magento2.git
synced 2026-06-15 05: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:
@@ -0,0 +1,34 @@
|
||||
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]
|
||||
}
|
||||
Reference in New Issue
Block a user