Correctly link to BE commit in version tab

This commit is contained in:
Sol Fisher Romanoff 2022-06-14 22:06:02 +03:00
parent 36309ebe04
commit adc6b86e6b
No known key found for this signature in database
GPG key ID: 9D3F2B64F2341B62
2 changed files with 15 additions and 4 deletions

View file

@ -1,6 +1,17 @@
export const extractCommit = versionString => {
const regex = /-g(\w+)/i
const matches = versionString.match(regex)
return matches ? matches[1] : ''
// X.Y.Z-1337-gdeadbeef => deadbeef
const commit = versionString.match(/-g(\w+)/i)
if (commit) {
return commit[1]
}
// X.Y.Z-develop => develop
const branch = versionString.match(/-([\w-/]+)$/i)
if (branch) {
return branch[1]
}
// X.Y.Z => vX.Y.Z
return 'v' + versionString
}