语义版本帮助工具
semver-tool的Python项目详细描述
Semver工具
打印git项目的semver版本。git标记必须与v?M.N.P
模式匹配。
您可以使用fotmat字符串打印特定的版本组件。
全格式字符串是mnprbd,其中:
- M-专业
- N-小调
- p-补丁
- R-预释放
- B-构建
用法
示例:
$ semver-tool
4.1.2-rc.2+git.b10c717
$ semver-tool -f MNPR
4.1.2-rc.2
用例
创建Docker图像
我使用这个工具来构建使用semver模式的docker图像。 流程如下:
- 用
Commit
标签构建image:latest
- 按
image:M.N.P-R
- 按
image:M.N.P
- 按
image:M.N
我的生成脚本包含以下代码
current=$(semver_tool -f MNPR) docker build --label Commit=$(semver_tool) -t image:$current docker tag image:$current image $(semver_tool -f MNP) docker tag image:$current image $(semver_tool -f MN)
从而产生这些图像
image 1.2.3-rc.2
image 1.2.3
image 1.2
每个图像都有Commit
标签,标签上有semver描述,例如,1.2.3-rc.2+git.22eeff