简体   繁体   English

如何使用标签更新gitlab CI中的节点版本

[英]How to update node version in gitlab CI using labels

I am using gitlab and it's CI for deployment of a node app. 我正在使用gitlab,它是用于部署节点应用程序的CI。 I can't seem to find an easy way to update the version on deployment based off an MR's labels. 我似乎找不到一种简单的方法来根据MR的标签在部署时更新版本。

Ex. 防爆。 I create an MR and add the label 'minor'. 我创建一个MR并添加标签“ minor”。 How can I call 'npm version minor' in the gitlab yml? 如何在gitlab yml中称呼“ npm version minor”?

Any help is much appreciated. 任何帮助深表感谢。

You can access your MR labels with $CI_MERGE_REQUEST_LABELS in your gitlab-ci.yml. 您可以在gitlab-ci.yml中使用$CI_MERGE_REQUEST_LABELS访问您的MR标签。 This will return a list of labels, so I don't know the format you will get. 这将返回标签列表,所以我不知道您将获得的格式。

in your script : 在您的脚本中:

npm version $CI_MERGE_REQUEST_LABELS npm版本$ CI_MERGE_REQUEST_LABELS

I did not test it, but you can give it a try. 我没有对其进行测试,但是您可以尝试一下。

You can see complete predefined environment variables here 您可以在此处查看完整的预定义环境变量

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM