modified: build.gradle

new file:   deploy.ps1
	new file:   quick-deploy.ps1
This commit is contained in:
SimolZimol
2025-10-09 18:30:19 +02:00
parent 7e5725ce3e
commit 9cbd605b3d
3 changed files with 107 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'org.hidetake.ssh' version '2.10.1'
}
group = 'com.simolzimol.levelcraft'
@@ -25,4 +26,37 @@ tasks.withType(JavaCompile).configureEach {
processResources {
from("plugin.yml")
}
// SSH Konfiguration für Server Upload
remotes {
server {
host = '195.201.241.113'
user = 'root'
// Option 1: Passwort (funktioniert zuverlässig)
password = System.getProperty('server.password') ?: System.getenv('SERVER_PASSWORD')
// Option 2: SSH Key (Gradle Plugin hat Kompatibilitätsprobleme)
// identity = file("${System.getProperty('user.home')}/.ssh/levelcraft_server_key_rsa")
// Host Key Verification deaktivieren (für Tests)
knownHosts = allowAnyHosts
}
}
// Upload Task - nur hochladen, kein Server-Neustart
task uploadPlugin(dependsOn: jar) {
group = 'deployment'
description = 'Lädt das Plugin auf den Server hoch'
doLast {
ssh.run {
session(remotes.server) {
println "Uploading plugin to server..."
put from: jar.archiveFile.get().asFile,
into: '/home/CloudNet/local/templates/develop/default/plugins/LevelCraft.jar'
println "Plugin successfully uploaded!"
}
}
}
}

29
deploy.ps1 Normal file
View File

@@ -0,0 +1,29 @@
# LevelCraft Plugin Deploy Script
param(
[switch]$UsePassword,
[string]$Password = $null
)
Write-Host "LevelCraft Plugin Deployment" -ForegroundColor Green
Write-Host "="*40 -ForegroundColor Green
if ($UsePassword) {
if (!$Password) {
$SecurePassword = Read-Host "Server Password" -AsSecureString
$Password = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($SecurePassword))
}
Write-Host "Using password authentication..." -ForegroundColor Yellow
$env:SERVER_PASSWORD = $Password
./gradlew uploadPlugin
Remove-Item Env:SERVER_PASSWORD -ErrorAction SilentlyContinue
} else {
Write-Host "Using SSH key authentication..." -ForegroundColor Yellow
./gradlew uploadPlugin
}
if ($LASTEXITCODE -eq 0) {
Write-Host "`nDeployment successful! ✅" -ForegroundColor Green
} else {
Write-Host "`nDeployment failed! ❌" -ForegroundColor Red
}

44
quick-deploy.ps1 Normal file
View File

@@ -0,0 +1,44 @@
# Einfaches Deploy Script für LevelCraft
param(
[switch]$SavePassword,
[switch]$Build
)
Write-Host "🚀 LevelCraft Quick Deploy" -ForegroundColor Green
Write-Host "=========================" -ForegroundColor Green
# Prüfe ob Passwort bereits gesetzt ist
if (-not $env:SERVER_PASSWORD) {
Write-Host "⚠️ Server-Passwort nicht gesetzt." -ForegroundColor Yellow
if ($SavePassword) {
Write-Host "💾 Passwort wird für diese PowerShell Session gespeichert..." -ForegroundColor Cyan
}
$securePassword = Read-Host "🔐 Server Passwort eingeben" -AsSecureString
$env:SERVER_PASSWORD = [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($securePassword))
if ($SavePassword) {
Write-Host "✅ Passwort gesetzt! Du musst es in dieser Session nicht mehr eingeben." -ForegroundColor Green
Write-Host "💡 Tipp: Verwende einfach './quick-deploy.ps1' für weitere Uploads." -ForegroundColor Cyan
}
}
if ($Build) {
Write-Host "🔨 Building plugin..." -ForegroundColor Yellow
./gradlew clean build
if ($LASTEXITCODE -ne 0) {
Write-Host "❌ Build failed!" -ForegroundColor Red
exit 1
}
}
Write-Host "📤 Uploading plugin..." -ForegroundColor Yellow
./gradlew uploadPlugin
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ Plugin successfully deployed!" -ForegroundColor Green
Write-Host "📁 Location: /home/CloudNet/local/templates/develop/default/plugins/LevelCraft.jar" -ForegroundColor Cyan
} else {
Write-Host "❌ Upload failed!" -ForegroundColor Red
}