[英]How to make a simple GitLab Ci/CD gitlab-ci.yml file to build an Angular project?
[英]How to bump package.json version of project on GitLab CI/CD?
我想在每次推送时package.json
版本变量:
0.1.0 => 0.1.1
(例如)我的项目使用Yarn ,因此我偶然发现了以下命令:
yarn version --patch --no-git-tag-version
This does indeed bump the version how I expect, but only affects the local cached package.json
file and not the package.json
file on the actual repository:
因此,我的问题是,如何通过 CI/CD 管道在实际GitLab存储库上碰撞package.json
版本变量?
你做得很好,但你需要提交新版本。 您可以通过保留标签来做到这一点,它将自动提交:
$ yarn version --patch
yarn version v1.22.5
info Current version: 0.1.0
info New version: 0.1.1
Done in 0.08s.
$ git log --oneline
c8211a0 (tag: v0.1.1) v0.1.1
或者您只需要在更改版本后提交:
$ yarn version --patch --no-git-tag-version
yarn version v1.22.5
info Current version: 0.1.0
info New version: 0.1.1
Done in 0.06s.
$ git commit -am "Bump version"
$ git log --oneline
944ee64 (HEAD -> main) Bump version
然后您必须推送到存储库,请参阅无法从 gitlab-ci.yml 推送。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.