fix(deploy): write .env to /opt/staging not \$HOME/staging
All checks were successful
Deploy — Staging / Lint, Typecheck & Test (push) Successful in 1m27s
Deploy — Staging / Build & push — admin (push) Successful in 54s
Deploy — Staging / Build & push — storefront (push) Successful in 55s
Deploy — Staging / Deploy to staging VPS (push) Successful in 20s

\$HOME in an unquoted heredoc expands on the runner (not the VPS), so the
VPS received the literal runner path (/root/staging/.env) which didn't exist.
Using the explicit /opt/staging/.env path (consistent with compose.yml and
mkdir) fixes the permission denied error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 13:04:40 +03:00
parent af8e14c545
commit 64c0cd6af8

View File

@@ -213,8 +213,8 @@ jobs:
# printf keeps every line indented (no column-0 content) so YAML stays valid. # printf keeps every line indented (no column-0 content) so YAML stays valid.
printf 'CLERK_SECRET_KEY=%s\nADMIN_CLERK_SECRET_KEY=%s\n' \ printf 'CLERK_SECRET_KEY=%s\nADMIN_CLERK_SECRET_KEY=%s\n' \
"${CLERK_SECRET_KEY}" "${ADMIN_CLERK_SECRET_KEY}" \ "${CLERK_SECRET_KEY}" "${ADMIN_CLERK_SECRET_KEY}" \
> $HOME/staging/.env > /opt/staging/.env
chmod 600 $HOME/staging/.env chmod 600 /opt/staging/.env
cd /opt/staging cd /opt/staging
podman compose up -d --force-recreate --remove-orphans podman compose up -d --force-recreate --remove-orphans