Archive reviewed candidate; not production acceptance (2026-09-24)
Android client acceptance / test-and-build (push) Has been cancelled
Android client acceptance / test-and-build (push) Has been cancelled
This commit is contained in:
+12
-3
@@ -1,6 +1,8 @@
|
||||
param(
|
||||
[switch]$InstrumentationOnly,
|
||||
[string]$Version = '1.0.2'
|
||||
[ValidatePattern('^\d+\.\d+\.\d+$')][string]$Version = '1.0.3',
|
||||
[string]$InputDirectory = '',
|
||||
[ValidatePattern('^[a-z0-9.-]*$')][string]$TestRevision = ''
|
||||
)
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$androidRoot = $PSScriptRoot
|
||||
@@ -16,7 +18,10 @@ $apkSigner = Join-Path $androidRoot '.tools/android-sdk/build-tools/37.0.0/apksi
|
||||
$zipAlign = Join-Path $androidRoot '.tools/android-sdk/build-tools/37.0.0/zipalign.exe'
|
||||
$keyStore = Join-Path $androidRoot '.tools/signing/ucvl-zonghengjia-release.jks'
|
||||
try {
|
||||
if ($InstrumentationOnly) {
|
||||
if ($InputDirectory) {
|
||||
$inputs = @(Get-ChildItem -LiteralPath ([IO.Path]::GetFullPath($InputDirectory)) -Filter '*.apk')
|
||||
if (-not $InstrumentationOnly) { $inputs = @($inputs | Where-Object Name -Like "UCVL-Zonghengjia-$Version-*.apk") }
|
||||
} elseif ($InstrumentationOnly) {
|
||||
$inputs = @(Get-ChildItem -LiteralPath (Join-Path $androidRoot 'V2rayNG/app/build/outputs/apk/androidTest/playstore/release') -Filter '*.apk')
|
||||
} else {
|
||||
$inputs = @(Get-ChildItem -LiteralPath (Join-Path $androidRoot 'V2rayNG/app/build/outputs/apk/playstore/release') -Filter "UCVL-Zonghengjia-$Version-*.apk")
|
||||
@@ -24,7 +29,11 @@ try {
|
||||
if (-not $inputs.Count) { throw 'No candidate APKs were built.' }
|
||||
foreach ($inputFile in $inputs) {
|
||||
$stageFile = Join-Path $androidRoot ('.tools/signing/aligned-' + $inputFile.Name)
|
||||
$outputFile = Join-Path $androidRoot ('releases/' + $inputFile.Name)
|
||||
$revision = if ($TestRevision) { "-$TestRevision" } else { '' }
|
||||
if ($TestRevision -and -not $InstrumentationOnly) { throw 'TestRevision is only for instrumentation artifacts' }
|
||||
$outputName = if ($InstrumentationOnly) { $inputFile.BaseName + "-$Version$revision.apk" } else { $inputFile.Name }
|
||||
$outputFile = Join-Path $androidRoot ('releases/' + $outputName)
|
||||
if (Test-Path -LiteralPath $outputFile) { throw "Refusing to overwrite existing signed artifact: $outputName" }
|
||||
& $zipAlign -f -p 4 $inputFile.FullName $stageFile
|
||||
if ($LASTEXITCODE) { throw 'APK alignment failed.' }
|
||||
& $apkSigner sign --ks $keyStore --ks-key-alias $signing['keyAlias'] --ks-pass env:UCVL_ANDROID_STORE_PASS --key-pass env:UCVL_ANDROID_KEY_PASS --out $outputFile $stageFile
|
||||
|
||||
Reference in New Issue
Block a user