fixing test and deploy script
Some checks failed
CI Deploy Laravel / Test (push) Successful in 1m18s
CI Deploy Laravel / Build (push) Successful in 1m4s
CI Deploy Laravel / Deploy (push) Failing after 11s

This commit is contained in:
2026-05-13 12:10:30 +08:00
parent 9f699c581c
commit 76ac6bbd9e

View File

@@ -75,36 +75,14 @@ jobs:
- name: Build frontend assets
run: npm run build
- name: Upload deployment artifact
uses: actions/upload-artifact@v4
with:
name: laravel-build
path: |
app
bootstrap
config
database
public
resources
routes
vendor
artisan
composer.json
package.json
vite.config.js
if-no-files-found: ignore
deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
steps:
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: laravel-build
path: release
- name: Checkout repository
uses: actions/checkout@v4
- name: Install sshpass
run: sudo apt-get update && sudo apt-get install -y sshpass
@@ -139,11 +117,14 @@ jobs:
rsync -az --delete \
-e "sshpass -e ssh -p ${DEPLOY_PORT:-22}" \
--exclude='.env' \
--exclude='.git' \
--exclude='storage/logs/*' \
--exclude='storage/framework/cache/*' \
--exclude='storage/framework/sessions/*' \
--exclude='storage/framework/views/*' \
release/ "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
--exclude='vendor' \
--exclude='node_modules' \
. "${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
- name: Create .env on server from secret
env:
@@ -167,7 +148,7 @@ jobs:
printf '%s' "$DEPLOY_ENV_FILE" | sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "mkdir -p \"${DEPLOY_PATH}\" && cat > \"${DEPLOY_PATH}/.env\" && chmod 600 \"${DEPLOY_PATH}/.env\""
- name: Run post-deploy Laravel commands
- name: Install dependencies and build on server
env:
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }}
@@ -181,7 +162,7 @@ jobs:
exit 1
fi
sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "cd ${DEPLOY_PATH} && php artisan optimize:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache"
sshpass -e ssh -p "${DEPLOY_PORT:-22}" "${DEPLOY_USER}@${DEPLOY_HOST}" "cd ${DEPLOY_PATH} && composer install --no-dev --optimize-autoloader && npm ci && npm run build && php artisan optimize:clear && php artisan config:cache && php artisan route:cache && php artisan view:cache"
# Required repository secrets:
# - DEPLOY_HOST: Server hostname or IP.