Jenkins 打包 Android
echo "======building version======";
$versionDate=Get-Date -Format 'yyyyMMddHHmmss';
echo "v$versionDate";
$appPublishPath="H:\devops\live4it";
echo "======svn change trigger======";
echo "======cd Live4It dir======";
pushd H:\SVNCode\MobileApp\CTdevNew\Live4It;
echo "======svn update======";
svn update --username 'hlchen' --password 'hlchen1';
echo "svn update success======";
echo "======begin publish======";
cd android;
./gradlew assembleRelease -console plain;
echo "======publish success======";
echo "======list apks======";
cd .\app\build\outputs\apk\release;
ls;
echo "======copy apk======";
if(Test-Path $appPublishPath){}
else{
mkdir $appPublishPath;
}
Copy-Item ".\app-release.apk" "$appPublishPath" 2>$null;
echo "======copy success======";
echo "======read version======";
$appconfig=(Get-Content "H:\SVNCode\MobileApp\CTdevNew\Live4It\src\utils\appconfig.js");
$ret=[regex]::Matches($appconfig,'var\s+appInfo\s*=\s*\{"AppVersion"\s*:\s*"(?<version>.*?)"');
$version=$ret.Groups[$ret.Groups.length-1].Value;
echo $version;
echo "======read success======";
echo "======rename apk name======";
pushd $appPublishPath;
Rename-Item ".\app-release.apk" ".\Live4It.$version.$versionDate.apk" 2>$null;
echo "======rename success======";
echo "======copy to default web site======";
Copy-Item ".\Live4It.$version.$versionDate.apk" "C:\inetpub\wwwroot\live4it_apk" 2>$null;
pushd C:\inetpub\wwwroot\live4it_apk;
Remove-Item ".\Live4It.apk" -Recurse 2>$null;;
Rename-Item ".\Live4It.$version.$versionDate.apk" ".\Live4It.apk" 2>$null;
echo "======copy success======";
echo "======success======";
如果您觉得本文对你有用,不妨帮忙点个赞,或者在评论里给我一句赞美,小小成就都是今后继续为大家编写优质文章的动力,百小僧拜谢!
欢迎您持续关注我的博客:)
版权所有,欢迎保留原文链接进行转载:)