dotnet 使用 gitlab-ci 为傻瓜发布 [英] dotnet publish with gitlab-ci for dummies
本文介绍了dotnet 使用 gitlab-ci 为傻瓜发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用 gitlab-ci 设置 ci.我有几个问题.
I am trying to setup ci with gitlab-ci. And I have a few questions about it.
- gitlab-ci 上好像没有回滚机制.那么,如果部署阶段失败,我应该关心回滚吗?
- 我打算使用dotnet publish Solution.sln -c release"脚本.但是我在这个解决方案中有多个项目.它有一个类库和 2 个 api.(如 AdminApi 和 UserApi).这两个 api 在 IIS 中托管不同的站点.在这种情况下,我如何使用参数配置 dotnet 发布脚本?
- 我应该使用 xcopy 之类的东西将发布输出移动到 iis 文件夹吗?
推荐答案
我已经在 iis 中为每个网站添加了一个 app_offile.htm_
,并在 html 中显示我们将很快回复消息".
I've put an app_offile.htm_
for each web sites in iis with "We'll back soon message" in html.
我已经用这个 gitlab-ci.yml 解决了我的问题
And I've solved my problem with this gitlab-ci.yml
stages:
- build
- test
- deploy
build:
stage: build
script:
- echo "Building the app"
- "dotnet publish MySolution.sln -c release"
artifacts:
untracked: true
only:
- dev
test:
stage: test
script: echo "Running tests"
artifacts:
untracked: true
dependencies:
- build
only:
- dev
deploy_staging:
stage: deploy
script:
- echo "Deployintg to staging server Admin"
- ren c:\inetpub\vhosts\xxx\admin\app_offline.htm_ app_offline.htm
- dotnet publish PathToAdmin.csproj -c release -o c:\inetpub\vhosts\xxx\admin
- ren c:\inetpub\vhosts\xxx\admin\app_offline.htm app_offline.htm_
- echo "Deployintg to staging server User"
- ren c:\inetpub\vhosts\xxx\user\app_offline.htm_ app_offline.htm
- dotnet publish PathToUser.csproj -c release -o c:\inetpub\vhosts\xxx\user
- ren c:\inetpub\vhosts\xxx\user\app_offline.htm app_offline.htm_
dependencies:
- build
only:
- dev
这篇关于dotnet 使用 gitlab-ci 为傻瓜发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文