我有一个页面作业,我想在分支上运行手动,但在master上自动触发:
pages:
stage: deploy
cache:
paths:
- public
script:
- scripts/pages.sh
artifacts:
paths:
- public
expire_in: 2 days
所以我想要一个组合:
only:
- master
when: always
only:
- branches
except:
- master
when: manual
那可能吗?
您需要定义两个阶段。你可以复制/粘贴或使用锚点:
.deploy_stage: &deploy_stage
stage: deploy
cache:
paths:
- public
script:
- scripts/pages.sh
artifacts:
paths:
- public
expire_in: 2 days
deploy_manual:
<<: *deploy_stage
only:
- branches
when: manual
deploy_master:
<<: *deploy_stage
only:
- master