我已经让AppVeyor构建了nuget程序包并为我部署了它们,但是现在我正在尝试对nuget程序包进行某些操作post_build
。
基本上,我有:
build:
project: XmlRpcCore.sln
parallel: true
verbosity: minimal
publish_nuget: true
publish_nuget_symbols: false
以及:
deploy:
- provider: NuGet
name: nuget_release
api_key:
secure: MJz3DvmtiuNK6IVsPbxR3gWiSCnhKqm6tmPsjdRDgwGx9L2PQSSZ1eE7YS8dkZhx
skip_symbols: true
on:
appveyor_repo_tag: true
依此类推,一切正常。
[现在,我的问题在于尝试在post_build
步骤之后在build
中找到要处理的nuget包。它不驻留在APPVEYOR_BUILD_FOLDER
中。我在输出中看到:
Successfully created package 'C:\Users\appveyor\AppData\Local\Temp\1\py7750yjd6\XmlRpcCore.3.1.0.62.nupkg'.
但是我看不到任何环境变量可以帮助我解决该问题,因此我可以在post_build
之前在deploy
中调用powershell命令,如下所示:
after_build:
- ps: dir
- ps: MagicCmd -InputPath "$env:<what might go here?>\XmlRpcCore.$env:TAG_VERSION.nuget"
有关生成的工件的信息可在PowerShell会话中找到:https://www.appveyor.com/docs/packaging-artifacts/#getting-information-about-uploaded-artifacts
[您可以在before_deploy
部分中使用一个简单的PowerShell脚本,分析该哈希并将所需的值放入环境变量中,例如,获取第一个生成的工件的路径:
before_deploy:
- ps: |
foreach ($artifactName in $artifacts.keys) {
$env:packagePath = $artifacts[$artifactName].path
break
}
- 'echo This is the path: %packagePath%'