-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (53 loc) · 1.49 KB
/
node-build.yml
File metadata and controls
60 lines (53 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Node Build
#
# Reusable workflow that installs dependencies and runs the npm build script.
#
# Usage in a consuming repository:
#
# jobs:
# build:
# uses: your-org/platform-tooling/.github/workflows/node-build.yml@v1
# with:
# working-directory: ./src
# node-version: "22"
name: Node Build
on:
workflow_call:
inputs:
working-directory:
description: "Directory containing package.json"
required: false
default: "."
type: string
build-command:
description: "npm script to run for building (e.g. build, build:prod)"
required: false
default: "build"
type: string
node-version:
description: "Node.js version to use (e.g. 20, 22)"
required: false
default: "20"
type: string
permissions:
contents: read
jobs:
build:
name: npm Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version: ${{ inputs.node-version }}
cache: "npm"
- name: Install dependencies
shell: bash
working-directory: ${{ inputs.working-directory }}
run: npm ci
- name: Build
shell: bash
working-directory: ${{ inputs.working-directory }}
run: npm run ${{ inputs.build-command }}