Install remote dependencies before deploying builds
CI / verify (push) Has been cancelled

The rsync excludes node_modules, so a new dependency in the lockfile made the
remote build fail until someone installed it by hand. Run npm ci on the server
first and stop with the installer's exit code if it fails.
This commit is contained in:
2026-12-01 15:27:17 +00:00
parent e7e1d16242
commit ea7b5b846c
+6
View File
@@ -122,6 +122,12 @@ function main() {
const sudoLines = SUDO_PASS ? `${SUDO_PASS}\n${SUDO_PASS}\n` : undefined;
const script = [
`cd ${REMOTE_PATH} || exit 3`,
// node_modules is excluded from the rsync, so a new dependency in the
// lockfile would otherwise fail the build on a server that has never
// installed it. Installed as the login user: the checkout belongs to them.
'npm ci --no-audit --no-fund',
'deps=$?',
'[ "$deps" -eq 0 ] || { echo "deploy: remote npm ci failed ($deps)"; exit "$deps"; }',
`${sudo}npm run build`,
'build=$?',
'[ "$build" -eq 0 ] || { echo "deploy: remote build failed ($build)"; exit "$build"; }',