Build frontend module
build-frontend-module.yml installs dependencies, builds the module, runs its lint, type checks and tests, and
uploads the build output as a workflow artifact. It is the CI half of the frontend pipeline; publishing is done by
Release frontend module.
Usage
on:
push:
branches: [main]
pull_request:
jobs:
build:
uses: openmrs/openmrs-contrib-gha-workflows/.github/workflows/build-frontend-module.yml@mainMost repositories need no inputs: the workflow infers everything from package.json.
What it does
- Infers the Node.js version, commands and artifact paths from
package.json(see Inference). - Installs dependencies with
yarn install --immutable. - Runs the build command, then
pre_verify_commandif set, then the verify command. - Uploads the build output as
<repository name>-packages.
When the repository has a turbo.json, Turborepo’s cache is backed by the GitHub Actions cache.
Inference
| Setting | Inferred from | Fallback |
|---|---|---|
| Node.js version | engines.node in package.json | 22 |
| Build command | yarn turbo run build when turbo.json exists, otherwise yarn build | |
| Verify command | yarn verify | |
| Artifact paths | <workspace>/dist for each workspaces glob in a monorepo | dist |
For monorepos whose verify script is a turbo command, --concurrency=<turbo_concurrency> is appended, unless the
script already sets --concurrency. Any input you pass overrides the inferred value.
OpenMRS defaults
O3 repositories use the defaults above with no inputs, except where a repository needs an extra step before
verification, such as pre_verify_command: yarn check-translations.
Outside OpenMRS
The workflow supports Yarn Berry (2+) repositories with the project at the repository root. It does not run Yarn 1, npm or pnpm projects.
If your repository does not declare engines.node, the build runs on Node.js 22. Set node_version to match what
you use locally.
Permissions
The build job requests contents: read only.
Inputs
| Name | Type | Default | Description |
|---|---|---|---|
node_version | string | Node.js version to use. If omitted, inferred from engines.node in package.json. | |
build_command | string | Command to build the project. If omitted, inferred from package.json. | |
verify_command | string | Command to run lint, type checks, and tests. If omitted, inferred from package.json. | |
pre_verify_command | string | Optional command to run before verify (e.g., yarn check-translations). Skipped if empty. | |
enable_turborepo_cache | string | Enable Turborepo remote caching, backed by the GitHub Actions cache. If omitted, inferred (true when turbo.json is present). | |
artifact_path | string | Path(s) to build artifacts to upload (glob supported). If omitted, inferred from package.json. | |
turbo_concurrency | string | 5 | Turborepo --concurrency for the inferred build and verify commands. Not added where the repo's own script already sets it. Empty for none. |