ci(web): use stable symlink APP_DIR (/home/renan/apps/sistema.current) and skip active dir during cleanup to prevent mount path disappearance
This commit is contained in:
parent
5dbe6986e6
commit
03d31d082c
1 changed files with 13 additions and 1 deletions
14
.github/workflows/ci-cd-web-desktop.yml
vendored
14
.github/workflows/ci-cd-web-desktop.yml
vendored
|
|
@ -178,6 +178,14 @@ jobs:
|
|||
pnpm prisma:generate
|
||||
pnpm build
|
||||
|
||||
- name: Update stable symlink for APP_DIR
|
||||
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")"
|
||||
|
||||
- name: Swarm deploy (stack.yml)
|
||||
run: |
|
||||
cd "$EFFECTIVE_APP_DIR"
|
||||
|
|
@ -185,7 +193,7 @@ jobs:
|
|||
set -o allexport
|
||||
if [ -f .env ]; then . ./.env; fi
|
||||
set +o allexport
|
||||
APP_DIR="$EFFECTIVE_APP_DIR" RELEASE_SHA=${{ github.sha }} docker stack deploy --with-registry-auth -c stack.yml sistema
|
||||
APP_DIR="$HOME/apps/sistema.current" RELEASE_SHA=${{ github.sha }} docker stack deploy --with-registry-auth -c stack.yml sistema
|
||||
|
||||
- name: Ensure Convex service envs and restart
|
||||
run: |
|
||||
|
|
@ -241,11 +249,15 @@ jobs:
|
|||
ROOT="$HOME/apps"
|
||||
KEEP=2
|
||||
PATTERN='web.build.*'
|
||||
ACTIVE="$(readlink -f "$HOME/apps/sistema.current" 2>/dev/null || echo)"
|
||||
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
|
||||
echo "$LIST" | sed "1,${KEEP}d" | while read dir; do
|
||||
[ -z "$dir" ] && continue
|
||||
if [ -n "$ACTIVE" ] && [ "$(readlink -f "$dir")" = "$ACTIVE" ]; then
|
||||
echo "Skipping active dir (in use by APP_DIR): $dir"; continue
|
||||
fi
|
||||
echo "Removing $dir"
|
||||
rm -rf "$dir" || {
|
||||
echo "Local rm failed, falling back to docker (root) cleanup for $dir..."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue