简体   繁体   中英

How to update node version in gitlab CI using labels

I am using gitlab and it's CI for deployment of a node app. I can't seem to find an easy way to update the version on deployment based off an MR's labels.

Ex. I create an MR and add the label 'minor'. How can I call 'npm version minor' in the gitlab yml?

Any help is much appreciated.

You can access your MR labels with $CI_MERGE_REQUEST_LABELS in your gitlab-ci.yml. 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

I did not test it, but you can give it a try.

You can see complete predefined environment variables here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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