Fix deploy symlink step for Gitea Actions runner.
Deploy Ladill Care / deploy (push) Successful in 51s

Remove stale current symlink before promoting release and document
passwordless sudo fallback for deploy user.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
isaacclad
2026-06-29 12:15:09 +00:00
co-authored by Cursor
parent 50ce3b96cf
commit cd4e919a33
2 changed files with 10 additions and 2 deletions
+7 -2
View File
@@ -239,15 +239,20 @@ if ! run_artisan "migrate --force"; then
fi
switch_current_release() {
# Remove a root-owned symlink left from manual bootstrap so deploy can replace it.
if [ -e "$CURRENT_LINK" ] || [ -L "$CURRENT_LINK" ]; then
rm -f "$CURRENT_LINK" 2>/dev/null || true
fi
if ln -sfnT "$NEW_RELEASE" "$CURRENT_LINK" 2>/dev/null; then
return 0
fi
if command -v sudo >/dev/null 2>&1 && sudo -n ln -sfnT "$NEW_RELEASE" "$CURRENT_LINK"; then
if command -v sudo >/dev/null 2>&1 && sudo -n rm -f "$CURRENT_LINK" && sudo -n ln -sfnT "$NEW_RELEASE" "$CURRENT_LINK"; then
return 0
fi
echo "Unable to update current release symlink at $CURRENT_LINK" >&2
echo "Unable to update current release symlink at $CURRENT_LINK (ensure $APP_ROOT is owned by the deploy user)" >&2
return 1
}