ci(web): publish build to stable path (/home/renan/apps/sistema) and deploy using that fixed APP_DIR; cleanup only web.build.*
This commit is contained in:
parent
9c498245e9
commit
009291f6a2
1 changed files with 11 additions and 11 deletions
22
.github/workflows/ci-cd-web-desktop.yml
vendored
22
.github/workflows/ci-cd-web-desktop.yml
vendored
|
|
@ -178,13 +178,13 @@ jobs:
|
||||||
pnpm prisma:generate
|
pnpm prisma:generate
|
||||||
pnpm build
|
pnpm build
|
||||||
|
|
||||||
- name: Update stable symlink for APP_DIR
|
- name: Publish build to stable APP_DIR directory
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
LINK="$HOME/apps/sistema.current"
|
DEST="$HOME/apps/sistema"
|
||||||
mkdir -p "$(dirname "$LINK")"
|
mkdir -p "$DEST"
|
||||||
ln -sfn "$EFFECTIVE_APP_DIR" "$LINK"
|
rsync -a --delete "$EFFECTIVE_APP_DIR"/ "$DEST"/
|
||||||
echo "Symlink set: $LINK -> $(readlink -f "$LINK")"
|
echo "Published build to: $DEST"
|
||||||
|
|
||||||
- name: Swarm deploy (stack.yml)
|
- name: Swarm deploy (stack.yml)
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -193,12 +193,12 @@ jobs:
|
||||||
set -o allexport
|
set -o allexport
|
||||||
if [ -f .env ]; then . ./.env; fi
|
if [ -f .env ]; then . ./.env; fi
|
||||||
set +o allexport
|
set +o allexport
|
||||||
APP_DIR_RESOLVED="$(readlink -f "$HOME/apps/sistema.current" || true)"
|
APP_DIR_STABLE="$HOME/apps/sistema"
|
||||||
if [ -z "$APP_DIR_RESOLVED" ] || [ ! -d "$APP_DIR_RESOLVED" ]; then
|
if [ ! -d "$APP_DIR_STABLE" ]; then
|
||||||
echo "ERROR: Resolved APP_DIR does not exist: $APP_DIR_RESOLVED" >&2; exit 1
|
echo "ERROR: Stable APP_DIR does not exist: $APP_DIR_STABLE" >&2; exit 1
|
||||||
fi
|
fi
|
||||||
echo "Using APP_DIR (resolved)=$APP_DIR_RESOLVED"
|
echo "Using APP_DIR (stable)=$APP_DIR_STABLE"
|
||||||
APP_DIR="$APP_DIR_RESOLVED" RELEASE_SHA=${{ github.sha }} docker stack deploy --with-registry-auth -c stack.yml sistema
|
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
|
- name: Ensure Convex service envs and restart
|
||||||
run: |
|
run: |
|
||||||
|
|
@ -254,7 +254,7 @@ jobs:
|
||||||
ROOT="$HOME/apps"
|
ROOT="$HOME/apps"
|
||||||
KEEP=2
|
KEEP=2
|
||||||
PATTERN='web.build.*'
|
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"
|
echo "Scanning $ROOT for old $PATTERN dirs"
|
||||||
LIST=$(find "$ROOT" -maxdepth 1 -type d -name "$PATTERN" | sort -r || true)
|
LIST=$(find "$ROOT" -maxdepth 1 -type d -name "$PATTERN" | sort -r || true)
|
||||||
echo "$LIST" | sed -n "1,${KEEP}p" | sed 's/^/Keeping: /' || true
|
echo "$LIST" | sed -n "1,${KEEP}p" | sed 's/^/Keeping: /' || true
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue