Only get first tag on build (#859)

This commit is contained in:
Uriel
2023-09-28 21:19:27 -03:00
committed by GitHub
parent 2bc50b2bc2
commit 4bd31fb02f
2 changed files with 10 additions and 7 deletions

View File

@@ -1,11 +1,14 @@
import react from '@vitejs/plugin-react';
import { defineConfig, PluginOption } from 'vite';
import { execSync } from 'child_process';
import path from 'path'
import path from 'path';
import { visualizer } from 'rollup-plugin-visualizer';
const commitHash = execSync('git rev-parse --verify --short HEAD').toString().trim();
const versionTag = execSync('git --no-pager tag --points-at HEAD').toString().trim();
const versionTag = execSync('git --no-pager tag --sort -taggerdate --points-at HEAD')
.toString()
.split('\n')[0]
.trim();
// If not empty then it's not clean
const gitClean = execSync('git status --porcelain').toString() ? false : true;
@@ -51,7 +54,7 @@ export default defineConfig({
},
resolve: {
alias: {
'@': path.resolve(__dirname, 'src')
}
}
'@': path.resolve(__dirname, 'src'),
},
},
});

View File

@@ -81,8 +81,8 @@ buildConfig {
packageName("dev.slimevr.desktop")
val gitVersionTag = providers.exec {
commandLine("git", "--no-pager", "tag", "--points-at", "HEAD")
}.standardOutput.asText.get()
commandLine("git", "--no-pager", "tag", "--sort", "-taggerdate", "--points-at", "HEAD")
}.standardOutput.asText.get().split('\n').first()
buildConfigField("String", "GIT_COMMIT_HASH", "\"${grgit.head().abbreviatedId}\"")
buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag.trim()}\"")
buildConfigField("boolean", "GIT_CLEAN", grgit.status().isClean.toString())