fix(ci): avoid shell-expansion in node version-compare helper
All checks were successful
Code Analysis and Production Deploy / analyze (push) Successful in 2m48s
Code Analysis and Production Deploy / deploy-production (push) Has been skipped
Code Analysis and Production Deploy / deploy-test (push) Successful in 1m58s

This commit is contained in:
Torsten Schulz (local)
2026-05-20 17:03:04 +02:00
parent a80ea7b892
commit 3658589d94

View File

@@ -30,6 +30,6 @@ REMOTE_VERSION=$(ssh -i ~/.ssh/id_ed25519 -p "$PROD_PORT" -o BatchMode=yes -o St
echo "Remote production version: $REMOTE_VERSION" echo "Remote production version: $REMOTE_VERSION"
# Compare versions using a small Node helper (semantic-ish: numeric dot-separated) # Compare versions using a small Node helper (semantic-ish: numeric dot-separated)
NODE_COMPARE="const a=process.env.LOCAL||'0.0.0'; const b=process.env.REMOTE||'0.0.0'; function cmp(x,y){const px=x.split('.').map(n=>parseInt(n||0,10)); const py=y.split('.').map(n=>parseInt(n||0,10)); const len=Math.max(px.length,py.length); for(let i=0;i<len;i++){const A=px[i]||0; const B=py[i]||0; if(A>B) return 1; if(A<B) return -1;} return 0;} const r=cmp(a,b); if(r<=0){ console.error(`Local version ${a} is not greater than production version ${b}`); process.exit(1);} else { console.log(`Local version ${a} is greater than production version ${b}`); process.exit(0);}" NODE_COMPARE='const a=process.env.LOCAL||"0.0.0"; const b=process.env.REMOTE||"0.0.0"; function cmp(x,y){const px=x.split(".").map(n=>parseInt(n||0,10)); const py=y.split(".").map(n=>parseInt(n||0,10)); const len=Math.max(px.length,py.length); for(let i=0;i<len;i++){const A=px[i]||0; const B=py[i]||0; if(A>B) return 1; if(A<B) return -1;} return 0;} const r=cmp(a,b); if(r<=0){ console.error(`Local version ${a} is not greater than production version ${b}`); process.exit(1);} else { console.log(`Local version ${a} is greater than production version ${b}`); process.exit(0);}'
LOCAL="$LOCAL_VERSION" REMOTE="$REMOTE_VERSION" node -e "$NODE_COMPARE" LOCAL="$LOCAL_VERSION" REMOTE="$REMOTE_VERSION" node -e "$NODE_COMPARE"