* Returns latest version (as x.y.z) from tags matching * `{tagPrefix}/vx.y.z`, or `0.0.0` if none.
(tagPrefix)
| 91 | * `{tagPrefix}/vx.y.z`, or `0.0.0` if none. |
| 92 | */ |
| 93 | function semverFromLatestTag(tagPrefix) { |
| 94 | const tags = git(['tag', '-l', `${tagPrefix}/v*`, '--sort=-v:refname']); |
| 95 | const tag = tags.split('\n').find(Boolean); |
| 96 | if (!tag) { |
| 97 | console.warn(`No tag found for ${tagPrefix}`); |
| 98 | return '0.0.0'; |
| 99 | } |
| 100 | const prefixSlashV = `${tagPrefix}/v`; |
| 101 | if (!tag.startsWith(prefixSlashV)) { |
| 102 | console.warn(`No tag found for ${tagPrefix}`); |
| 103 | return '0.0.0'; |
| 104 | } |
| 105 | return tag.slice(prefixSlashV.length); |
| 106 | } |
| 107 | |
| 108 | function getShortHash() { |
| 109 | return git(['rev-parse', '--short', 'HEAD']); |
no test coverage detected