forked from fei-ke/HMSPush
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathdeploy.ps1
More file actions
27 lines (23 loc) · 807 Bytes
/
deploy.ps1
File metadata and controls
27 lines (23 loc) · 807 Bytes
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
param([switch]$Debug)
Write-Host "Checking for uncommitted changes" -ForegroundColor Green
[string]$res = git status --porcelain
if ($res) {
Write-Host "Commit changes before deploying" -ForegroundColor Red
return;
}
Write-Host "Validating build" -ForegroundColor Green
./build
if ($LASTEXITCODE -ne 0) {
return
}
$type = if ($Debug) { 'debug' } else { 'release' }
$file = ls .\app\build\outputs\apk\$type\*.apk
$path = $file.FullName
Write-Host "Deploying $path" -ForegroundColor Green
$devices = adb devices | % { if ($null = $_ -match '^(\S+)\s+device$') { $Matches[1] } }
foreach ($device in $devices) {
Write-Host "Deploying for $device" -ForegroundColor Green
adb -s $device install $path
Write-Host "Restarting SystemUI" -ForegroundColor Green
adb shell am crash com.android.systemui
}