mirror of
https://github.com/SlimeVR/SlimeVR-Server.git
synced 2026-04-06 02:01:58 +02:00
Override tauri config version with git tag (#994)
This commit is contained in:
3
.github/workflows/build-gui.yml
vendored
3
.github/workflows/build-gui.yml
vendored
@@ -85,9 +85,10 @@ jobs:
|
||||
run: cargo clean
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run skipbundler
|
||||
pnpm run skipbundler --config $( ./gui/scripts/gitversion.mjs )
|
||||
|
||||
- if: matrix.os == 'windows-latest'
|
||||
name: Upload a Build Artifact (Windows)
|
||||
|
||||
7
.github/workflows/gradle.yaml
vendored
7
.github/workflows/gradle.yaml
vendored
@@ -183,7 +183,7 @@ jobs:
|
||||
- name: Build
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run tauri build
|
||||
pnpm run tauri build --config $( ./gui/scripts/gitversion.mjs )
|
||||
|
||||
- name: Make GUI tarball
|
||||
run: |
|
||||
@@ -259,7 +259,7 @@ jobs:
|
||||
run: |
|
||||
rustup target add x86_64-apple-darwin
|
||||
pnpm i
|
||||
pnpm run tauri build --target universal-apple-darwin
|
||||
pnpm run tauri build --target universal-apple-darwin --config $( ./gui/scripts/gitversion.mjs )
|
||||
|
||||
- name: Modify Application
|
||||
run: |
|
||||
@@ -331,9 +331,10 @@ jobs:
|
||||
run: cargo clean
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
run: |
|
||||
pnpm i
|
||||
pnpm run skipbundler
|
||||
pnpm run skipbundler --config $( ./gui/scripts/gitversion.mjs )
|
||||
|
||||
- name: Bundle to zips
|
||||
shell: bash
|
||||
|
||||
21
gui/scripts/gitversion.mjs
Executable file
21
gui/scripts/gitversion.mjs
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env node
|
||||
import { promisify } from 'node:util';
|
||||
import { exec as execCallback } from 'node:child_process';
|
||||
const exec = promisify(execCallback);
|
||||
|
||||
const [commitHash, versionTag, gitClean] = await Promise.all([
|
||||
exec('git rev-parse --verify --short HEAD').then((res) =>
|
||||
res.stdout.trim().substring(1)
|
||||
),
|
||||
exec('git --no-pager tag --sort -taggerdate --points-at HEAD').then((res) =>
|
||||
res.stdout.split('\n')[0].trim()
|
||||
),
|
||||
// If not empty then it's not clean
|
||||
exec('git status --porcelain').then((res) => (res.stdout ? false : true)),
|
||||
]);
|
||||
|
||||
console.log(
|
||||
JSON.stringify({
|
||||
version: `${versionTag || `0.0.0-${commitHash}`}${gitClean ? '' : '-dirty'}`,
|
||||
})
|
||||
);
|
||||
Reference in New Issue
Block a user