【发布时间】:2016-10-17 20:46:06
【问题描述】:
我正在将一个项目添加到 teamcity 中,并且需要添加一个 powershell 脚本来更改一些配置设置并生成一个压缩的工件。我已经在 teamcity 之外构建并测试了脚本文件,但为了使其在构建期间工作,我需要获取构建工件的路径。
有没有办法将c:\artifacts\myproject\build\38 下方的代码中的代码替换为始终获取最新构建目录的 teamcity 参数?
#Find and replace various app.config settings
$location = C:\Artifacts\MyProject\Build\38\myApp\myConfig.config";
(Get-Content $location) |
ForEach-Object { $_ -replace '<add key="platform" value="xxxx"/>', '<add key="platform" value="test"/>' } |
Set-Content $location
#Should take source directory and create a zip file from it
$source = "C:\Artifacts\MyProject\Build\38\myApp\"
$destination = "C:\Artifacts\FrontOfficeApi\Build\38\artifact.zip"
GenerateZipFile -DestinationFilePath $destination -SourcePath $source
非常感谢
【问题讨论】:
标签: powershell teamcity