Skip to Content
WorkflowsBuild frontend module

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

.github/workflows/ci.yml
on: push: branches: [main] pull_request: jobs: build: uses: openmrs/openmrs-contrib-gha-workflows/.github/workflows/build-frontend-module.yml@main

Most repositories need no inputs: the workflow infers everything from package.json.

What it does

  1. Infers the Node.js version, commands and artifact paths from package.json (see Inference).
  2. Installs dependencies with yarn install --immutable.
  3. Runs the build command, then pre_verify_command if set, then the verify command.
  4. 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

SettingInferred fromFallback
Node.js versionengines.node in package.json22
Build commandyarn turbo run build when turbo.json exists, otherwise yarn build
Verify commandyarn verify
Artifact paths<workspace>/dist for each workspaces glob in a monorepodist

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

NameTypeDefaultDescription
node_versionstringNode.js version to use. If omitted, inferred from engines.node in package.json.
build_commandstringCommand to build the project. If omitted, inferred from package.json.
verify_commandstringCommand to run lint, type checks, and tests. If omitted, inferred from package.json.
pre_verify_commandstringOptional command to run before verify (e.g., yarn check-translations). Skipped if empty.
enable_turborepo_cachestringEnable Turborepo remote caching, backed by the GitHub Actions cache. If omitted, inferred (true when turbo.json is present).
artifact_pathstringPath(s) to build artifacts to upload (glob supported). If omitted, inferred from package.json.
turbo_concurrencystring5Turborepo --concurrency for the inferred build and verify commands. Not added where the repo's own script already sets it. Empty for none.
Last updated on