Gitlab-CI:检出推送到的分支以外的其他分支

Gitlab-CI: checkout other branch than the one pushed to

我有一个设置,其中我在存储库中有两个分支。

dev_softwaredev_content

dev_content 设置为保存 dev_content.

的 git 子模块

当内容开发人员推送到 dev_content 时,我需要触发与软件开发人员推送到 dev_software 时相同的构建过程。因此我需要在每次推送时在 CI 中签出 dev_software

怎么做?

我找到了一个方法:

在每个阶段将以下内容放在开头:

build_multilang:
  stage: build
  script:
    - "git checkout dev_software"
    - "git pull"
    - <your other scripts here>