Skip to content

Commit 56cf00a

Browse files
Merge pull request #3775 from laststance/fix/deploy-prisma-cli-node
fix: run prisma deploy through node
2 parents b70bfb4 + 151e243 commit 56cf00a

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ jobs:
250250
return 1
251251
}
252252
253+
run_prisma_cli() {
254+
# Run Prisma through Node so deploys do not depend on executable bits in unpacked artifacts.
255+
node ./node_modules/prisma/build/index.js "$@"
256+
}
257+
253258
fail_deployment() {
254259
message="$1"
255260
echo "::error::$message"
@@ -262,6 +267,7 @@ jobs:
262267
263268
require_command curl
264269
require_command find
270+
require_command node
265271
require_command rsync
266272
require_command tar
267273
@@ -297,7 +303,7 @@ jobs:
297303
cd "$staging_dir"
298304
# Pending migrations make `status` non-zero, but drift/failed states should stop before deploy.
299305
set +e
300-
migration_status_output=$(./node_modules/.bin/prisma migrate status 2>&1)
306+
migration_status_output=$(run_prisma_cli migrate status 2>&1)
301307
migration_status_code=$?
302308
set -e
303309
printf '%s\n' "$migration_status_output"
@@ -309,10 +315,10 @@ jobs:
309315
*)
310316
echo "::error::Prisma migration status reported an unsafe state"
311317
exit "$migration_status_code"
312-
;;
313-
esac
318+
;;
319+
esac
314320
fi
315-
./node_modules/.bin/prisma migrate deploy
321+
run_prisma_cli migrate deploy
316322
) || fail_deployment "Prisma migration failed; PM2 restart skipped"
317323
318324
# Prisma may touch generated client files during migration; re-extract a clean artifact before rsync.

0 commit comments

Comments
 (0)