This repository was archived by the owner on Feb 16, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
64 lines (63 loc) · 2.01 KB
/
javascript-library-build.yml
File metadata and controls
64 lines (63 loc) · 2.01 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
61
62
63
64
###############################################################################
# Javascript Library Build Workflow
# Build and test a JavaScript Library
###############################################################################
on:
workflow_call:
inputs:
node-versions:
description: 'Node versions to use'
required: false
default: '[18,20,22]'
type: string
upload-node-version:
description: 'Node version to use for uploading artifacts'
required: false
default: '22'
type: string
pnpm-version:
description: 'PNPM version to use'
required: false
default: '9'
type: string
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ${{ fromJson(inputs.node-versions) }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: ${{ inputs.pnpm-version }}
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Get pnpm store directory
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: "${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}"
restore-keys: |
${{ runner.os }}-${{ matrix.node-version }}-pnpm-store-
- name: Install dependencies
run: pnpm i --frozen-lockfile --prefer-offline
- run: pnpm build
- run: pnpm test
- name: Upload artifacts
if: matrix.node-version == inputs.upload-node-version
uses: actions/upload-artifact@v4
with:
name: build-artifact
path: |
*
!node_modules
!**/node_modules