This feature is available from Liferay Workspace 6.1.0
How to create a custom client-extension.yaml file to allow deploying different configurations depending on the need.
What is it?
Liferay Workspace now supports creating custom Client Extension "Profiles" to deploy different configurations from the same project. This is done within a project using one or more client-extension.yaml files with this naming scheme:
client-extensions.{profileName}.yaml
Here are some examples:
client-extension.dev.yaml
client-extension.uat.yaml
client-extension.test.yaml
For each of the above example files, workspace will create a new custom deploy task. The following tasks will now be available in your project:
deployDev
deployUat
deployTest
The profileName section can be any combination of lowercase letters. They are currently detected by this pattern: client-extension\.([a-z]+)\.yaml
For the purpose of this documentation, we will call the files that follow this format a profile, though that term is subject to change. So we could refer to the "dev profile", meaning the client-extension.dev.yaml profile and the associated deploy task deployDev.
What does it do?
Each profile defines values that will override the values provided in the base client-extension.yaml file. A custom deploy task is registered based on the filename. Invoking this task will cause the client-extension.yaml file to be evaluated first, then any values found in the profile yaml file will overwrite the corresponding value in the base yaml file.
So if you ran deployFoo, the values in this base client-extension.yaml file would be evaluated:
one: footwo: barthree:first: 1second: 2
Then those values would be overridden by values in this profile client-extension.foo.yaml file:
two: hello
three:second: world
and would result in this structure being used:
one: foo
two: hello
three:
first: 1
second: world
Only scalar values (string, number, boolean) and arrays are replaced. Objects are not replaced, only the scalar and array values inside them.