Enhance deployment script with improved permissions checks and error handling for composer installation

This commit is contained in:
baodev0
2026-07-13 11:34:32 +07:00
parent 8d3410f8cc
commit c1008d579c
+18 -2
View File
@@ -16,13 +16,14 @@ jobs:
with: with:
host: ${{ secrets.HOST }} host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }} username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }} password: ${{ secrets.PASSWORD }}
port: ${{ secrets.PORT }} port: ${{ secrets.PORT }}
script_stop: true script_stop: true
script: | script: |
set -ex set -ex
export PATH="$HOME/.phpenv/shims:$PATH" export PATH="$HOME/.phpenv/shims:$PATH"
umask 002
php -v php -v
@@ -42,7 +43,22 @@ jobs:
git clone -b "$BRANCH" "${{ secrets.REPO_URL }}" . git clone -b "$BRANCH" "${{ secrets.REPO_URL }}" .
fi fi
composer install --optimize-autoloader --no-interaction mkdir -p storage/framework/{cache,sessions,views} storage/logs bootstrap/cache
chmod -R u+rwX storage bootstrap/cache vendor 2>/dev/null || true
if test -e vendor/composer/installed.php && ! test -w vendor/composer/installed.php; then
echo "vendor/composer/installed.php is not writable by $(whoami). Current ownership:"
ls -ld vendor vendor/composer vendor/composer/installed.php
exit 1
fi
if test -d vendor/composer && ! test -w vendor/composer; then
echo "vendor/composer is not writable by $(whoami). Current ownership:"
ls -ld vendor vendor/composer
exit 1
fi
composer install --optimize-autoloader --no-interaction --no-dev
php artisan migrate --force php artisan migrate --force