dotnet publish with gitlab-ci for dummies

dotnet publish with gitlab-ci for dummies

我正在尝试使用 gitlab-ci 设置 ci。我对此有一些疑问。

  1. gitlab-ci上好像没有回滚机制。如果部署阶段失败,我应该关心回滚吗?
  2. 我打算使用 "dotnet publish Solution.sln -c release" 脚本。但是我在这个解决方案中有多个项目。它有一个classlib和2个api。 (如 AdminApi 和 UserApi)。而这 2 apis 托管在 IIS 中的不同站点。在这种情况下,如何使用参数配置 dotnet 发布脚本?
  3. 我应该使用 xcopy 之类的工具将发布输出移动到 iis 文件夹吗?

我在 iis 中为每个网站添加了 app_offile.htm_,在 html 中添加了 "We'll back soon message"。

我已经用这个 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