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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with:
fetch-depth: 0 # Needed for tags
- uses: actions/setup-node@v3 - uses: actions/setup-node@v3
with: with:
node-version: 18 node-version: 18

View File

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