feat: Playtube fuer Android - nur YouTube Music, Hintergrundwiedergabe, Updates ueber Gitea
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# Baut die signierte Release-APK von Playtube fuer Android.
|
||||
#
|
||||
# powershell -ExecutionPolicy Bypass -File scripts\build-release.ps1
|
||||
#
|
||||
# Beim ersten Aufruf wird ein Signierschluessel angelegt (keystore\playtube.jks) und das zufaellige
|
||||
# Passwort in keystore.properties gespeichert. BEIDES liegt nur lokal (steht in .gitignore).
|
||||
# WICHTIG: keystore\ und keystore.properties an einem zweiten Ort sichern - jede Version muss mit
|
||||
# demselben Schluessel signiert sein, sonst laesst sie sich nicht ueber die vorherige installieren.
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $root
|
||||
|
||||
$keystoreDir = Join-Path $root "keystore"
|
||||
$keystore = Join-Path $keystoreDir "playtube.jks"
|
||||
$properties = Join-Path $root "keystore.properties"
|
||||
|
||||
if (-not (Test-Path $properties)) {
|
||||
Write-Host "==> Lege Signierschluessel an (einmalig) ..." -ForegroundColor Cyan
|
||||
$keytool = (Get-Command keytool -ErrorAction SilentlyContinue).Source
|
||||
if (-not $keytool -and $env:JAVA_HOME) { $keytool = Join-Path $env:JAVA_HOME "bin\keytool.exe" }
|
||||
if (-not $keytool -or -not (Test-Path $keytool)) { throw "keytool nicht gefunden (JDK installieren / JAVA_HOME setzen)." }
|
||||
|
||||
New-Item -ItemType Directory -Path $keystoreDir -ErrorAction SilentlyContinue | Out-Null
|
||||
$bytes = New-Object byte[] 48
|
||||
[System.Security.Cryptography.RandomNumberGenerator]::Create().GetBytes($bytes)
|
||||
$password = ([Convert]::ToBase64String($bytes) -replace '[^A-Za-z0-9]', '').Substring(0, 32)
|
||||
|
||||
& $keytool -genkeypair -keystore $keystore -alias playtube -keyalg RSA -keysize 4096 -validity 10000 `
|
||||
-storepass $password -keypass $password -dname "CN=Playtube, O=Playtube"
|
||||
if ($LASTEXITCODE -ne 0) { throw "Schluessel konnte nicht angelegt werden." }
|
||||
|
||||
Set-Content -Path $properties -Encoding ASCII -Value @(
|
||||
"storeFile=keystore/playtube.jks",
|
||||
"storePassword=$password",
|
||||
"keyAlias=playtube",
|
||||
"keyPassword=$password"
|
||||
)
|
||||
Write-Host "Schluessel angelegt. SICHERE den Ordner keystore\ und die Datei keystore.properties!" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "==> Baue Release-APK ..." -ForegroundColor Cyan
|
||||
& .\gradlew.bat :app:testDebugUnitTest :app:assembleRelease
|
||||
if ($LASTEXITCODE -ne 0) { throw "Build fehlgeschlagen." }
|
||||
|
||||
$version = (Select-String -Path (Join-Path $root "app\build.gradle.kts") -Pattern 'versionName = "([^"]+)"').Matches[0].Groups[1].Value
|
||||
$outDir = Join-Path $root "app\build\outputs\apk\release"
|
||||
$apk = Join-Path $outDir "Playtube-Android-v$version.apk"
|
||||
Copy-Item (Join-Path $outDir "app-release.apk") $apk -Force
|
||||
Write-Host "Fertig: $apk" -ForegroundColor Green
|
||||
Reference in New Issue
Block a user