Angular + Jenkins + IIS

echo "======solution dircectory======";
ls;

echo "======building version======";
$versionDate=Get-Date -Format 'yyyyMMddHHmmss';
echo "v$versionDate";

$appPublishPath="H:\devops\memberportal\v$versionDate\publish";
$iisSiteName="Default Web Site/memberportal/";

echo "======change api.config.ts======";
cd .\src\app\services\api-services\;
Remove-Item ./api.config.ts -Recurse;
Rename-Item ./api.config.Staging.ts api.config.ts;
echo "======change success======";

echo "======begin restore packages======";
cd ../../../../;
npm install;
echo "======restore success======";


echo "======begin build code source======";
ng build --prod --aot --build-optimizer --extract-css --vendor-chunk=true --base-href ./ --output-path=$appPublishPath 2>$null;
echo "======build success======";


echo "======go to publish direcctory======";
pushd $appPublishPath;

pushd C:\WINDOWS\system32\inetsrv;

echo "======change iis dir======";
./appcmd set vdir $iisSiteName -physicalPath:$appPublishPath;
echo "======change success======";

echo "======restart iis site======";
./appcmd stop site $iisSiteName;
./appcmd start site $iisSiteName;
echo "======restart success======";

echo "The Application is running......";
posted @ 2020-06-08 17:31  百小僧  阅读(240)  评论(0编辑  收藏  举报