forked from ryangriggs/PDFEncrypt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
publishAndroidApp.ps1
42 lines (33 loc) · 1.88 KB
/
publishAndroidApp.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
param([String]$AndroidSigningPassword, [int]$ApplicationVersion )
# run as admin to prepare dependencies
# choco install androidstudio openjdk -y
# click through update in adnroid studio
# trigger updates in Android studio
# dotnet workload install android maui
$packageName = "com.codeuctivity.LockPDFy"
# https://learn.microsoft.com/en-us/dotnet/maui/android/deployment/publish-cli#create-a-keystore-file
# Signing using .net maui stack is a mess, finaly using https://stackoverflow.com/questions/50560045/sign-android-app-bundle-from-command-line it was accepted by google play store
# check if file exists
if (!(Test-Path "../GooglePlayStore.keystore")) {
throw "../GooglePlayStore.keystore not found";
}
# keytool -export -rfc -keystore ../GooglePlayStore.keystore -alias LockPDFyMaui -file upload_certificate.pem
# keytool -list -keystore GooglePlayStore.keystore
if ([String]::IsNullOrEmpty($AndroidSigningPassword)) {
$AndroidSigningPassword = Read-Host -Prompt "Enter Android Signing Password" -AsSecureString
}
if ([String]::IsNullOrEmpty($ApplicationVersion)) {
$ApplicationVersion = Read-Host -Prompt "Enter Application Version" -AsSecureString
}
if (Test-Path -Path "./LockPDFyMaui/bin") {
Write-Host "Removing existing directory"
Remove-Item -Recurse -ErrorAction:Stop ./LockPDFyMaui/bin
}
dotnet clean
dotnet restore
dotnet build -c Release
dotnet test -c Release --no-build
dotnet publish LockPDFyMaui -f net8.0-android -c Release -p:ApplicationVersion=$ApplicationVersion -p:ApplicationDisplayVersion=$ApplicationVersion.0 -p:ApplicationId=$packageName
jarsigner -verbose -sigalg SHA256withRSA -digestalg SHA-256 -keystore ../GooglePlayStore.keystore .\LockPDFyMaui\bin\Release\net8.0-android\publish\$packageName.aab AndroidApps -storepass $AndroidSigningPassword
rm .\LockPDFyMaui\bin\Release\net8.0-android\publish\*signed.a*
explorer .\LockPDFyMaui\bin\Release\net8.0-android\publish\