feat: Neue Versionierungsstrategie mit Build- und Hotfix-Postfix eingeführt
- Versionierung auf das Muster `vX.Y.Z` für Builds und `vX.Y.Z.N` für Hotfixes umgestellt. - `Z` wird nun bei jedem Commit als Build-Nummer erhöht, um Änderungen nachzuvollziehen. - `N` wird als Patch-Postfix für Bugfixes in bestehenden Versionen genutzt (`vX.Y.Z.1`, `vX.Y.Z.2` usw.). - Erleichtert Wartung und gezielte Fehlerbehebung für Kunden mit älteren Versionen. - Verbesserte Struktur für langfristige Skalierbarkeit und Nachvollziehbarkeit.
This commit is contained in:
@@ -5,5 +5,5 @@
|
|||||||
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
|
||||||
|
|
||||||
*/
|
*/
|
||||||
const webVersion = "1.0.6.11";
|
const webVersion = "1.6.12";
|
||||||
export default webVersion;
|
export default webVersion;
|
||||||
|
|||||||
@@ -3,17 +3,45 @@ const fs = require("fs");
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const versionFilePath = path.join(process.cwd(), "config/webVersion.ts");
|
const versionFilePath = path.join(process.cwd(), "config/webVersion.ts");
|
||||||
|
|
||||||
|
// Falls die Datei nicht existiert, erstelle eine Standardversion
|
||||||
|
if (!fs.existsSync(versionFilePath)) {
|
||||||
|
fs.writeFileSync(
|
||||||
|
versionFilePath,
|
||||||
|
`export const WEB_VERSION = "1.0.0.0";\n`,
|
||||||
|
"utf8"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
const versionFile = fs.readFileSync(versionFilePath, "utf8");
|
const versionFile = fs.readFileSync(versionFilePath, "utf8");
|
||||||
|
|
||||||
// Regex, um Versionsnummer zu finden
|
// Regex, um Versionsnummer zu finden (vX.Y.Z oder vX.Y.Z.N)
|
||||||
const versionRegex = /(\d+)\.(\d+)\.(\d+)\.(\d+)/;
|
const versionRegex = /(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?/;
|
||||||
const match = versionFile.match(versionRegex);
|
const match = versionFile.match(versionRegex);
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
let [major, minor, patch, build] = match.slice(1).map(Number);
|
let [major, minor, patch, build] = match
|
||||||
build++; // Erhöhe die Build-Nummer automatisch
|
.slice(1)
|
||||||
|
.map((num) => (num !== undefined ? Number(num) : 0));
|
||||||
|
|
||||||
const newVersion = `${major}.${minor}.${patch}.${build}`;
|
const isHotfix = process.env.HOTFIX_MODE === "true"; // Umgebungsvariable für Hotfixes
|
||||||
|
|
||||||
|
if (isHotfix) {
|
||||||
|
build++; // Falls ein Hotfix gemacht wird, nur `N` erhöhen (vX.Y.Z.N)
|
||||||
|
console.log(
|
||||||
|
`🔧 Hotfix-Modus aktiv – Erhöhe Patch-Fix auf: ${major}.${minor}.${patch}.${build}`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
patch++; // Normale Builds erhöhen `Z`
|
||||||
|
build = 0; // Falls es kein Hotfix ist, beginnt `N` wieder bei 0
|
||||||
|
console.log(
|
||||||
|
`📦 Normale Build-Erhöhung – Neue Version: ${major}.${minor}.${patch}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const newVersion = isHotfix
|
||||||
|
? `${major}.${minor}.${patch}.${build}`
|
||||||
|
: `${major}.${minor}.${patch}`;
|
||||||
const updatedFile = versionFile.replace(versionRegex, newVersion);
|
const updatedFile = versionFile.replace(versionRegex, newVersion);
|
||||||
|
|
||||||
fs.writeFileSync(versionFilePath, updatedFile, "utf8");
|
fs.writeFileSync(versionFilePath, updatedFile, "utf8");
|
||||||
|
|||||||
Reference in New Issue
Block a user