update
This commit is contained in:
@@ -12,62 +12,27 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Deploy
|
||||
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
|
||||
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17
|
||||
with:
|
||||
host: ${{ secrets.HOST }}
|
||||
username: ${{ secrets.USERNAME }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
fingerprint: ${{ secrets.SSH_HOST_FINGERPRINT }}
|
||||
port: ${{ secrets.PORT }}
|
||||
script_stop: true
|
||||
|
||||
script: |
|
||||
set -ex
|
||||
set -e
|
||||
|
||||
export PATH="$HOME/.phpenv/shims:$PATH"
|
||||
umask 002
|
||||
cd ~/httpdocs
|
||||
|
||||
php -v
|
||||
|
||||
BRANCH="production"
|
||||
|
||||
cd httpdocs
|
||||
|
||||
if test -d .git; then
|
||||
echo "Updating source..."
|
||||
|
||||
git fetch origin
|
||||
|
||||
git reset --hard origin/$BRANCH
|
||||
else
|
||||
echo "First deploy..."
|
||||
|
||||
git clone -b "$BRANCH" "${{ secrets.REPO_URL }}" .
|
||||
fi
|
||||
|
||||
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 --no-dev --optimize-autoloader
|
||||
|
||||
composer dump-autoload --no-dev --optimize
|
||||
echo "==> Pulling latest code..."
|
||||
git fetch origin production
|
||||
git reset --hard origin/production
|
||||
|
||||
echo "==> Running migrations..."
|
||||
php artisan migrate --force
|
||||
|
||||
php artisan config:clear
|
||||
echo "==> Optimizing Laravel..."
|
||||
php artisan optimize
|
||||
|
||||
php artisan queue:restart || true
|
||||
|
||||
echo "Deploy completed."
|
||||
echo "==> Deploy completed!"
|
||||
|
||||
Reference in New Issue
Block a user