From 009291f6a28c30f494d72f14807b1962b3f59038 Mon Sep 17 00:00:00 2001 From: Esdras Renan Date: Thu, 16 Oct 2025 14:53:59 -0300 Subject: [PATCH] ci(web): publish build to stable path (/home/renan/apps/sistema) and deploy using that fixed APP_DIR; cleanup only web.build.* --- .github/workflows/ci-cd-web-desktop.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-cd-web-desktop.yml b/.github/workflows/ci-cd-web-desktop.yml index 4bbe2b3..08ea340 100644 --- a/.github/workflows/ci-cd-web-desktop.yml +++ b/.github/workflows/ci-cd-web-desktop.yml @@ -178,13 +178,13 @@ jobs: pnpm prisma:generate pnpm build - - name: Update stable symlink for APP_DIR + - name: Publish build to stable APP_DIR directory run: | set -e - LINK="$HOME/apps/sistema.current" - mkdir -p "$(dirname "$LINK")" - ln -sfn "$EFFECTIVE_APP_DIR" "$LINK" - echo "Symlink set: $LINK -> $(readlink -f "$LINK")" + DEST="$HOME/apps/sistema" + mkdir -p "$DEST" + rsync -a --delete "$EFFECTIVE_APP_DIR"/ "$DEST"/ + echo "Published build to: $DEST" - name: Swarm deploy (stack.yml) run: | @@ -193,12 +193,12 @@ jobs: set -o allexport if [ -f .env ]; then . ./.env; fi set +o allexport - APP_DIR_RESOLVED="$(readlink -f "$HOME/apps/sistema.current" || true)" - if [ -z "$APP_DIR_RESOLVED" ] || [ ! -d "$APP_DIR_RESOLVED" ]; then - echo "ERROR: Resolved APP_DIR does not exist: $APP_DIR_RESOLVED" >&2; exit 1 + APP_DIR_STABLE="$HOME/apps/sistema" + if [ ! -d "$APP_DIR_STABLE" ]; then + echo "ERROR: Stable APP_DIR does not exist: $APP_DIR_STABLE" >&2; exit 1 fi - echo "Using APP_DIR (resolved)=$APP_DIR_RESOLVED" - APP_DIR="$APP_DIR_RESOLVED" RELEASE_SHA=${{ github.sha }} docker stack deploy --with-registry-auth -c stack.yml sistema + echo "Using APP_DIR (stable)=$APP_DIR_STABLE" + APP_DIR="$APP_DIR_STABLE" RELEASE_SHA=${{ github.sha }} docker stack deploy --with-registry-auth -c stack.yml sistema - name: Ensure Convex service envs and restart run: | @@ -254,7 +254,7 @@ jobs: ROOT="$HOME/apps" KEEP=2 PATTERN='web.build.*' - ACTIVE="$(readlink -f "$HOME/apps/sistema.current" 2>/dev/null || echo)" + ACTIVE="$HOME/apps/sistema" echo "Scanning $ROOT for old $PATTERN dirs" LIST=$(find "$ROOT" -maxdepth 1 -type d -name "$PATTERN" | sort -r || true) echo "$LIST" | sed -n "1,${KEEP}p" | sed 's/^/Keeping: /' || true