name: Deploy to Dev on: push: branches: [ main, master, develop, dev ] jobs: deploy-dev: runs-on: ubuntu-latest steps: - name: Debug Secrets run: | echo "=== Debugging Secrets ===" echo "DEV_HOST: ${{ secrets.DEV_HOST }}" echo "DEV_USER: ${{ secrets.DEV_USER }}" echo "SSH_PRIVATE_KEY length: ${#SSH_PRIVATE_KEY}" echo "SSH_PRIVATE_KEY first 50 chars: ${SSH_PRIVATE_KEY:0:50}" echo "All secrets:" env | grep -E "SECRET|SSH|DEV" || echo "No secrets found" - name: Deploy to Dev Server uses: appleboy/ssh-action@v1.0.0 env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} with: host: ${{ secrets.DEV_HOST }} username: ${{ secrets.DEV_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} use_insecure_cipher: true debug: true script: | set -e cd /var/www/platform/dev echo "đŸ“Ļ Pulling latest changes from repository..." git pull origin main || git pull origin master || git pull origin develop || git pull origin dev || true echo "🔄 Restarting Docker services..." docker compose restart echo "📊 Running migrations (if needed)..." docker compose exec -T web python manage.py migrate || true echo "📁 Collecting static files (if needed)..." docker compose exec -T web python manage.py collectstatic --noinput || true echo "✅ Dev deployment completed successfully" echo "â„šī¸ You can continue working directly on the server" - name: Health Check uses: appleboy/ssh-action@v1.0.0 env: SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} with: host: ${{ secrets.DEV_HOST }} username: ${{ secrets.DEV_USER }} key: ${{ secrets.SSH_PRIVATE_KEY }} use_insecure_cipher: true debug: true script: | sleep 10 docker compose ps curl -f http://localhost:8124/health/ || exit 1 echo "✅ Health check passed"