CI: Versionsnummer wird bei jedem Versions-Tag automatisch in tauri.conf.json, package.json und Cargo.toml gesetzt
All checks were successful
Windows Installer bauen / build-windows (push) Successful in 7m52s

This commit is contained in:
Jürgen Zwiener 2026-09-17 16:42:26 +02:00
parent f2cf99a724
commit 74a8517f4f

View file

@ -139,6 +139,35 @@ jobs:
$changelog = "changelog<<CHANGELOG_EOF`n$($log -join "`n")`nCHANGELOG_EOF"
Add-Content -Path $env:GITHUB_OUTPUT -Value $changelog
- name: Versionsnummer aus Tag automatisch setzen (nur bei Versions-Tag)
if: startsWith(github.ref, 'refs/tags/v')
working-directory: tauri-app
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
$version = "${{ github.ref_name }}" -replace '^v', ''
Write-Host "Setze Version auf $version in tauri.conf.json, package.json, Cargo.toml ..."
$confPath = "src-tauri/tauri.conf.json"
$content = Get-Content $confPath -Raw
$neu = $content -replace '("version"\s*:\s*)"[^"]*"', "`$1`"$version`""
if ($neu -eq $content) { Write-Error "Version in $confPath nicht gefunden/ersetzt." }
Set-Content -Path $confPath -Value $neu -NoNewline
$pkgPath = "package.json"
$content = Get-Content $pkgPath -Raw
$neu = $content -replace '("version"\s*:\s*)"[^"]*"', "`$1`"$version`""
if ($neu -eq $content) { Write-Error "Version in $pkgPath nicht gefunden/ersetzt." }
Set-Content -Path $pkgPath -Value $neu -NoNewline
$cargoPath = "src-tauri/Cargo.toml"
$content = Get-Content $cargoPath -Raw
$neu = $content -replace '(?m)^version = "[^"]*"', "version = `"$version`""
if ($neu -eq $content) { Write-Error "Version in $cargoPath nicht gefunden/ersetzt." }
Set-Content -Path $cargoPath -Value $neu -NoNewline
Write-Host " Erledigt, alle drei Dateien jetzt auf $version."
- name: Bauen und signieren (nur bei Versions-Tag)
if: startsWith(github.ref, 'refs/tags/v')
working-directory: tauri-app