# reusable-node-build — build/test an npm- or bun-based project (999_testing). # # A REUSABLE workflow (on: workflow_call) downstream repos call: # jobs: # build: # uses: olsitec/foundation/.forgejo/workflows/reusable-node-build.yml@master # with: { package-manager: bun, build: "bun run build" } # # Runs in the baked foundation-ci image (bun + node present). Covers the # non-Docker candidate shapes: npm package built with npm (olsicrypto), bun # package built with bun (document-engine), and the no-build / versioned-only # utility (olsitrack/api) via an empty `build`. name: reusable-node-build on: workflow_call: inputs: package-manager: description: "bun | npm | none (none = skip install)" type: string default: bun build: description: "build command to run verbatim (empty = skip, e.g. no-artifact repos)" type: string default: "" workdir: description: "working directory for install + build" type: string default: "." jobs: build: runs-on: docker container: image: foundation-ci:latest defaults: run: working-directory: ${{ inputs.workdir }} steps: - uses: actions/checkout@v4 - name: Install dependencies (${{ inputs.package-manager }}) run: | case "${{ inputs.package-manager }}" in bun) bun install --frozen-lockfile || bun install ;; npm) npm ci || npm install ;; none) echo "package-manager=none → skipping install" ;; *) echo "unknown package-manager '${{ inputs.package-manager }}'" >&2; exit 1 ;; esac - name: Build run: | cmd='${{ inputs.build }}' if [ -z "$cmd" ]; then echo "no build command (non-artifact / versioned-only repo) — install-only check passed" exit 0 fi echo "+ $cmd" eval "$cmd"