57 lines
1.5 KiB
YAML
57 lines
1.5 KiB
YAML
name: Node Build
|
|
description: Install dependencies, build, and upload a build artifact
|
|
inputs:
|
|
INSTALL_CMD:
|
|
description: "Install command"
|
|
default: "npm ci"
|
|
BUILD_SCRIPT:
|
|
description: "npm script to run for the main build"
|
|
default: "build:stage"
|
|
EXTRA_BUILD_SCRIPT:
|
|
description: "Optional additional npm script to run after the main build"
|
|
default: ""
|
|
ARTIFACT_NAME:
|
|
description: "Name to give the uploaded artifact"
|
|
default: "dist"
|
|
ARTIFACT_PATH:
|
|
description: "Path to upload as the artifact"
|
|
default: "dist"
|
|
COPY_PRISMA_ENGINE:
|
|
description: "Copy the Prisma query engine binaries into the build directory"
|
|
default: "false"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: actions/setup-node@v5
|
|
with:
|
|
node-version-file: package.json
|
|
|
|
- name: Install
|
|
shell: sh
|
|
run: ${{ inputs.INSTALL_CMD }}
|
|
|
|
- name: Build
|
|
shell: sh
|
|
run: |
|
|
npm run ${{ inputs.BUILD_SCRIPT }}
|
|
if [ -n "${{ inputs.EXTRA_BUILD_SCRIPT }}" ]; then
|
|
npm run ${{ inputs.EXTRA_BUILD_SCRIPT }}
|
|
fi
|
|
|
|
- name: Copy Prisma Client Engine
|
|
if: inputs.COPY_PRISMA_ENGINE == 'true'
|
|
shell: sh
|
|
run: |
|
|
mkdir -p build/prisma
|
|
cp node_modules/.prisma/client/libquery_engine-* build/prisma/
|
|
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ inputs.ARTIFACT_NAME }}
|
|
path: ${{ inputs.ARTIFACT_PATH }}
|