From 76ac6bbd9e51bad948b76d5d5c6447edc2b025da Mon Sep 17 00:00:00 2001 From: Iszuddin Ismail Date: Wed, 13 May 2026 12:10:30 +0800 Subject: [PATCH] fixing test and deploy script --- .gitea/workflows/ci.yml | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/.gitea/workflows/ci.yml b/.gitea/workflows/ci.yml index 607f1cb..07ef380 100644 --- a/.gitea/workflows/ci.yml +++ b/.gitea/workflows/ci.yml @@ -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.