81 lines
2.6 KiB
YAML
81 lines
2.6 KiB
YAML
name: PNPM Build
|
|
description: >
|
|
Build and validate frontend using PNPM.
|
|
|
|
inputs:
|
|
working-directory:
|
|
description: Directory containing package.json
|
|
required: false
|
|
default: "."
|
|
node-version:
|
|
description: Node.js version
|
|
required: false
|
|
default: "24"
|
|
pnpm-version:
|
|
description: pnpm version
|
|
required: false
|
|
default: "10.33"
|
|
jfrog-token:
|
|
description: JFrog npm auth token
|
|
required: false
|
|
default: ""
|
|
run-scripts:
|
|
description: Comma-separated list of pnpm run scripts
|
|
required: false
|
|
default: "ci,typecheck,build"
|
|
frozen-lockfile:
|
|
description: Pass --frozen-lockfile to pnpm install
|
|
required: false
|
|
default: "true"
|
|
check-dedupe:
|
|
description: Run pnpm dedupe --check
|
|
required: false
|
|
default: "true"
|
|
|
|
runs:
|
|
using: composite
|
|
steps:
|
|
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
|
|
# actions/setup-node v6.4.0 — https://code.forgejo.org/actions/setup-node/commits/tag/v6.4.0
|
|
- name: Setup Node
|
|
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e
|
|
with:
|
|
node-version: ${{ inputs.node-version }}
|
|
|
|
# Pinned to commit SHA instead of a tag to prevent supply chain attacks.
|
|
# pnpm/action-setup v6.0.3 — https://code.forgejo.org/pnpm/action-setup/commits/tag/v6.0.3
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@903f9c1a6ebcba6cf41d87230be49611ac97822e
|
|
with:
|
|
version: ${{ inputs.pnpm-version }}
|
|
|
|
- name: Configure pnpm registry authentication
|
|
if: ${{ inputs.jfrog-token != '' }}
|
|
shell: bash
|
|
env:
|
|
JFROG_TOKEN: ${{ inputs.jfrog-token }}
|
|
run: pnpm set //schmalz.jfrog.io/artifactory/api/npm/default-npm/:_authToken "$JFROG_TOKEN"
|
|
|
|
- name: Build
|
|
shell: bash
|
|
env:
|
|
PNPM_VERSION: ${{ inputs.pnpm-version }}
|
|
WORKING_DIR: ${{ inputs.working-directory }}
|
|
RUN_SCRIPTS: ${{ inputs.run-scripts }}
|
|
FROZEN_LOCKFILE: ${{ inputs.frozen-lockfile }}
|
|
CHECK_DEDUPE: ${{ inputs.check-dedupe }}
|
|
run: |
|
|
if [ "${CHECK_DEDUPE}" = "true" ]; then
|
|
pnpm --prefix="${WORKING_DIR}" dedupe --check
|
|
fi
|
|
|
|
INSTALL_ARGS=""
|
|
if [ "${FROZEN_LOCKFILE}" = "true" ]; then
|
|
INSTALL_ARGS="--frozen-lockfile"
|
|
fi
|
|
pnpm --prefix="${WORKING_DIR}" install $INSTALL_ARGS
|
|
|
|
IFS=',' read -ra SCRIPTS <<< "${RUN_SCRIPTS}"
|
|
for script in "${SCRIPTS[@]}"; do
|
|
pnpm --prefix="${WORKING_DIR}" run "${script}"
|
|
done
|