Fix version string when building with github actions

This commit is contained in:
Marcel Hellkamp 2023-07-20 12:25:16 +02:00
parent a766bb1ba8
commit c0c770e86c
2 changed files with 7 additions and 3 deletions

View File

@ -15,6 +15,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for tags
- uses: actions/setup-node@v3
with:
node-version: 18

View File

@ -9,9 +9,11 @@ var version;
try {
var gitInfo = gitDescribeSync();
version = `${gitInfo.tag}`;
if (gitInfo.distance)
version += `-${gitInfo.distance}+${gitInfo.hash}`
if(gitInfo.tag) {
version = `${gitInfo.tag}`;
if (gitInfo.distance)
version += `-${gitInfo.distance}+${gitInfo.hash}`
}
} catch { }
// https://vitejs.dev/config/