Improved version number unification

This commit is contained in:
patben8 committed 2026-07-09 00:34:25 +02:00
1 parent 6504623aac
commit 75deded209
7 files changed
+70 -9

No files matched your search

+6 -5
View File
@@ -126,11 +126,12 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
# App version from tauri.conf.json (e.g. 0.1.0); the run number keeps each # App version from the single source of truth, frontend/package.json (the
# tag unique → tag like v0.1.0-build.42. # same value Tauri names the installers from). The run number is appended
# as a -b<N> suffix to keep each push's tag/release unique → e.g. v0.1.1-b42.
- name: Resolve version - name: Resolve version
id: version id: version
run: echo "version=$(jq -r .version frontend/src-tauri/tauri.conf.json)" >> "$GITHUB_OUTPUT" run: echo "version=$(jq -r .version frontend/package.json)" >> "$GITHUB_OUTPUT"
- name: Download installers from both builds - name: Download installers from both builds
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@@ -140,8 +141,8 @@ jobs:
- name: Publish release - name: Publish release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
tag_name: v${{ steps.version.outputs.version }}-build.${{ github.run_number }} tag_name: v${{ steps.version.outputs.version }}-b${{ github.run_number }}
name: Konduktor v${{ steps.version.outputs.version }} (build ${{ github.run_number }}) name: Konduktor v${{ steps.version.outputs.version }}-b${{ github.run_number }}
target_commitish: ${{ github.sha }} target_commitish: ${{ github.sha }}
generate_release_notes: true # auto changelog from commits/PRs since last release generate_release_notes: true # auto changelog from commits/PRs since last release
fail_on_unmatched_files: true fail_on_unmatched_files: true
+20
View File
@@ -158,6 +158,26 @@ frontend at `http://localhost:5173`.
- Python 3.14 note: pin dependencies loosely enough to get prebuilt wheels - Python 3.14 note: pin dependencies loosely enough to get prebuilt wheels
(older `pydantic-core` pins force a from-source Rust build that fails). (older `pydantic-core` pins force a from-source Rust build that fails).
## Versioning
**There is ONE source of truth for the app version: the `version` field in
[frontend/package.json](frontend/package.json).** To release a new version, bump
that number and nothing else — everything derives from it:
- **Tauri / installers** — `tauri.conf.json` sets `"version": "../package.json"`,
so the `.dmg`/`.exe` names + bundle version come from `package.json`.
- **Backend API** — `konduktor/__init__.py` `_read_version()` reads
`package.json` (dev: `<repo>/frontend/package.json`; frozen sidecar: bundled at
the PyInstaller root via `sys._MEIPASS`, added in `konduktor-sidecar.spec`).
`main.py` uses this for the FastAPI `version`. Falls back to `"0.0.0"` if not
found (cosmetic, must never crash startup).
- **CI release** — `.github/workflows/build.yml` reads it with
`jq .version frontend/package.json` and tags each push
`v<version>-b<run_number>` (release name `Konduktor v<version>-b<run_number>`).
The `-b<N>` suffix keeps every push's tag/release unique.
- **NOT a source**: `src-tauri/Cargo.toml` `version` is inert Rust crate metadata
(Tauri uses the config's `../package.json`); don't treat it as the app version.
## Roadmap ## Roadmap
- ✅ Phase 1 — backend core + read-only API - ✅ Phase 1 — backend core + read-only API
+5
View File
@@ -28,6 +28,11 @@ for pkg in ("uvloop", "httptools", "websockets"):
# Imported by name, not statically discoverable. # Imported by name, not statically discoverable.
hiddenimports += ["multipart", "anyio"] hiddenimports += ["multipart", "anyio"]
# Bundle the canonical version file so konduktor.__version__ can read it at
# runtime from sys._MEIPASS (frontend/package.json is the single source of the
# app version — see konduktor/__init__.py). Path is relative to this spec.
datas += [("../frontend/package.json", ".")]
a = Analysis( a = Analysis(
["sidecar.py"], ["sidecar.py"],
pathex=[], pathex=[],
+33 -1
View File
@@ -1,3 +1,35 @@
"""Konduktor — Traktor library management & track preparation.""" """Konduktor — Traktor library management & track preparation."""
__version__ = "0.1.1" from __future__ import annotations
import json
import sys
from pathlib import Path
def _read_version() -> str:
"""Return the app version — the single source of truth is
``frontend/package.json`` (also what Tauri names the installers from).
- Dev / source checkout: read it from the repo, two levels up from this
package (``<repo>/frontend/package.json``).
- Frozen sidecar: ``package.json`` is bundled at the PyInstaller root (see
``konduktor-sidecar.spec``), reachable via ``sys._MEIPASS``.
Falls back to ``"0.0.0"`` if it can't be located (the FastAPI version string
is cosmetic, so a miss must never crash startup).
"""
candidates = []
meipass = getattr(sys, "_MEIPASS", None)
if meipass:
candidates.append(Path(meipass) / "package.json")
candidates.append(Path(__file__).resolve().parents[2] / "frontend" / "package.json")
for path in candidates:
try:
return json.loads(path.read_text(encoding="utf-8"))["version"]
except Exception:
continue
return "0.0.0"
__version__ = _read_version()
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"name": "frontend", "name": "frontend",
"private": true, "private": true,
"version": "0.0.0", "version": "0.1.1",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
+4 -1
View File
@@ -1,6 +1,9 @@
[package] [package]
name = "app" name = "app"
version = "0.1.0" # Rust crate metadata only — NOT the app version. The bundled app version comes
# from frontend/package.json (see tauri.conf.json `"version": "../package.json"`),
# so this value is inert for the installer/bundle and needn't be kept in sync.
version = "0.1.1"
description = "A Tauri App" description = "A Tauri App"
authors = ["you"] authors = ["you"]
license = "" license = ""
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "$schema": "../node_modules/@tauri-apps/cli/config.schema.json",
"productName": "Konduktor", "productName": "Konduktor",
"version": "0.1.0", "version": "../package.json",
"identifier": "com.liquidicestudios.konduktor", "identifier": "com.liquidicestudios.konduktor",
"build": { "build": {
"frontendDist": "../dist", "frontendDist": "../dist",