【发布时间】:2020-09-12 23:33:21
【问题描述】:
我有这个 .gitlab-ci.yml 文件:
image: node:latest
stages:
- build
- test
- publish
cache:
key:
files:
- package.json
- package-lock.json
paths:
- node_modules
build:
stage: build
script:
- echo -e "//my.private.repo.com/:_authToken=${NPM_TOKEN}\n$(cat .npmrc)">.npmrc
- npm install
- npm run build
artifacts:
paths:
- node_modules
- .npmrc
test:
stage: test
script:
- npm test
publish:
stage: publish
script:
- npm publish
only:
- tags
使用此配置,当我推送一个简单的提交时,一切正常:按预期构建 + 测试。
但是,当我推送标签(在此处使用npm version 创建时,会创建两个管道:1 个用于提交,1 个用于标签。因此,构建和测试执行了两次。
我可以做些什么来防止这种行为,并让标签管道“取消”提交管道
【问题讨论】:
标签: gitlab-ci