From 234c41d0b6b7a186aa43dcbf1ea86a9e550ca7c2 Mon Sep 17 00:00:00 2001 From: Alejandro Rosales Date: Wed, 27 Aug 2025 11:47:50 -0600 Subject: [PATCH] refactor: update deployment script to use variables for remote host, user, and path --- deploy.ps1 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/deploy.ps1 b/deploy.ps1 index 2d2cefa..6c1ae74 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -1,14 +1,26 @@ -# deploy.ps1 +# Fail fast +$ErrorActionPreference = 'Stop' + +# Config +$REMOTE_HOST = "github.lci.ulsa.mx" +$REMOTE_USER = "root" +$REMOTE_PATH = "/var/lib/docker/sistemas/genesis/layout" + Write-Output "▶ Building project..." bun run build Write-Output "▶ Cleaning remote folder..." -ssh root@github.lci.ulsa.mx "find /var/lib/docker/sistemas/genesis/layout -mindepth 1 -delete" +ssh ${REMOTE_USER}@${REMOTE_HOST} "find ${REMOTE_PATH} -mindepth 1 -delete" Write-Output "▶ Uploading dist to server..." -scp -r ./dist/* root@github.lci.ulsa.mx:/var/lib/docker/sistemas/genesis/layout/ +scp -r ./dist/* ${REMOTE_USER}@${REMOTE_HOST}:${REMOTE_PATH}/ -Write-Output "▶ Fixing permissions..." -ssh root@github.lci.ulsa.mx "chmod -R 755 /var/lib/docker/sistemas/genesis/layout/assets" +Write-Output "▶ Fixing permissions (assets)..." +ssh ${REMOTE_USER}@${REMOTE_HOST} "chmod -R 755 ${REMOTE_PATH}/assets || true" + +Write-Output "▶ Remove dist (local)..." +if (Test-Path ./dist) { + Remove-Item -Recurse -Force ./dist +} Write-Output "✅ Deploy finished!"