fix(ci): corrige permissoes do rsync no deploy VPS

O runner do Forgejo roda com UID 999, mas o workflow estava
fazendo chown para UID 1000, causando erros de permissao no rsync.

- Usa id -u e id -g para pegar o UID/GID correto do runner
- Remove --chown do rsync para usar permissoes do runner

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
esdrasrenan 2025-12-16 21:00:39 -03:00
parent 1f88880dbd
commit 9a65679ca4

View file

@ -241,13 +241,15 @@ jobs:
DEST="$HOME/apps/sistema" DEST="$HOME/apps/sistema"
mkdir -p "$DEST" mkdir -p "$DEST"
mkdir -p "$DEST/.next/static" mkdir -p "$DEST/.next/static"
docker run --rm -v "$DEST":/target alpine:3 sh -lc 'chown -R 1000:1000 /target 2>/dev/null || true; chmod -R u+rwX /target 2>/dev/null || true' || true # Corrigir permissoes para o runner (UID 999)
RUNNER_UID=$(id -u)
RUNNER_GID=$(id -g)
docker run --rm -v "$DEST":/target alpine:3 sh -lc "chown -R $RUNNER_UID:$RUNNER_GID /target 2>/dev/null || true; chmod -R u+rwX /target 2>/dev/null || true" || true
if [ -d "$EFFECTIVE_APP_DIR/.next/static" ]; then if [ -d "$EFFECTIVE_APP_DIR/.next/static" ]; then
rsync -a \ rsync -a \
"$EFFECTIVE_APP_DIR/.next/static/" "$DEST/.next/static/" "$EFFECTIVE_APP_DIR/.next/static/" "$DEST/.next/static/"
fi fi
rsync -a --delete \ rsync -a --delete \
--chown=1000:1000 \
--exclude '.pnpm-store' --exclude '.pnpm-store/**' \ --exclude '.pnpm-store' --exclude '.pnpm-store/**' \
--exclude '.next/static' \ --exclude '.next/static' \
"$EFFECTIVE_APP_DIR"/ "$DEST"/ "$EFFECTIVE_APP_DIR"/ "$DEST"/