Override tauri config version with git tag (#994)

This commit is contained in:
Uriel authored and GitHub committed 2024-06-14 17:55:09 +02:00
1 parent 6626cabeaa
commit fbb0b8a460
3 files changed
+27 -4

No files matched your search

+2 -1
View File
@@ -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)
+4 -3
View File
@@ -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
View 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'}`,
})
);