我有一个Asp.Net MVC项目,它通过AppVeyor部署到Azure应用服务,其appveyor.yml文件配置为将GitHub提交部署到生产和暂存。
配置是 -
分段部署可以毫无问题地构建和部署,但是,分段部署仍然以“Release”配置为目标,尽管它已设置为Staging分支的“Staging”。我可以看到这一点,当我登录到登台时,它指向Staging Azure SQL数据库。
本地测试
我已经在Staging配置中进行了本地测试,它在这方面起作用。
我假设appveyor.yml文件配置不正确,因此AppVeyor没有获取Staging配置?
version: 1.0.{build}
build_script:
- ps: .\build.cmd CreateNuGet
nuget:
account_feed: true
artifacts:
- path: output\*.*
test: off
for:
# configuration for "master" branch
# build in Release mode and deploy to the Azure prod environment
-
branches:
only:
- master
configuration: Release
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# configuration for "staging" branch
# build in Staging mode and deploy to the Azure staging environment
-
branches:
only:
- staging
configuration: Staging
deploy:
provider: WebDeploy
server: [removed for brevity]
website: [removed for brevity]
username: [removed for brevity]
password: [removed for brevity]
ntlm: false
remove_files: true
app_offline: false
# "fall back" configuration for all other branches
# no "branches" section defined
# do not deploy at all
configuration: Debug
我怀疑“后退”配置会覆盖先前设置的配置。通过删除它(或可能将其移动到文件的顶部),您将获得所需的结果。