GitLab CI 使用 if 语句的语法是什么

GitLab CI What is the syntax for using if statements

我想在我的构建脚本中检查我的一个变量的值,以便仅在变量具有特定值时进行部署。

deploy utilities:
  stage: deploy
  script:
    - echo %DEPLOY%
    - if [ "%DEPLOY%" == "utilities" ]; then 'msbuild.exe Build\TCBuild.CreateAndPublishNugetPackages.Utilities.Targets /p:BUILD_NUMBER=%CI_BUILD_ID%'; fi
  dependencies:
    - restore deploy packages
    - build utilities
  only: 
    - triggers
  artifacts:
    name: 'Utilities_nuget-package%CI_BUILD_ID%'
    expire_in: 1 days
    paths: 
    - Build

但是构建时出现以下错误:

"utilities" was unexpected at this time.

在 .gitlab-ci.yml 中使用 if 语句的正确语法是什么?

我的跑步者正在使用 Windows CMD,因此语法错误。

正确的语法是:

IF "%DEPLOY%" == "utilities" msbuild.exe Build\TCBuild.CreateAndPublishNugetPackages.Utilities.Targets /p:BUILD_NUMBER=%CI_BUILD_ID%