pack and upload
Deploy to FTP / deploy (push) Successful in 5s

This commit is contained in:
Sebastian Molenda
2026-06-13 11:16:53 +02:00
parent 332fef0fd3
commit e4db4bb31e
141 changed files with 516 additions and 211 deletions
+49
View File
@@ -65,4 +65,53 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "org.jetbrains.kotlin:kotlin-stdlib:1.9.22"
implementation 'androidx.webkit:webkit:1.8.0'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.3'
// JSONObject is provided by Android SDK (org.json)
}
// Task: package webapp assets into a zip for release and optionally upload
def webappSrc = file("src/main/assets")
def webappZip = file("${buildDir}/outputs/webapp/webapp.zip")
tasks.register("zipWebApp") {
group = "release"
description = "Create zip of web assets (app/src/main/assets -> webapp.zip)"
inputs.dir(webappSrc)
outputs.file(webappZip)
doLast {
webappZip.parentFile.mkdirs()
ant.zip(destfile: webappZip) {
fileset(dir: webappSrc)
}
println "Created webapp zip: ${webappZip.absolutePath}"
}
}
tasks.register("uploadWebApp") {
group = "release"
description = "Upload webapp zip to remote server if UPLOAD_WEBAPP_URL is set"
dependsOn "zipWebApp"
doLast {
def uploadUrl = System.getenv('UPLOAD_WEBAPP_URL')
def token = System.getenv('UPLOAD_WEBAPP_TOKEN')
if (!uploadUrl) {
println "UPLOAD_WEBAPP_URL not set, skipping upload"
return
}
if (!webappZip.exists()) {
throw new GradleException("webapp zip not found: ${webappZip}")
}
println "Uploading webapp to ${uploadUrl}"
def cmd = ["curl", "--fail", "-X", "PUT", "-H", "Content-Type: application/zip"]
if (token) {
cmd += ["-H", "Authorization: Bearer ${token}"]
}
cmd += ["--data-binary", "@${webappZip.absolutePath}", uploadUrl]
def process = cmd.execute()
process.in.eachLine { println it }
process.err.eachLine { System.err.println it }
def rc = process.waitFor()
if (rc != 0) throw new GradleException("Upload failed with exit code ${rc}")
println "Upload successful"
}
}