From 4675ea5020d60de501ad9b361625d1f34d24f5e6 Mon Sep 17 00:00:00 2001 From: CaIon Date: Sun, 5 Oct 2025 18:20:43 +0800 Subject: [PATCH] fix: update versioning logic in electron-build.yml to correctly handle prerelease formats and modify product name in package.json --- .github/workflows/electron-build.yml | 14 +++----------- electron/package.json | 2 +- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/.github/workflows/electron-build.yml b/.github/workflows/electron-build.yml index 9e53ff76..cae38a0d 100644 --- a/.github/workflows/electron-build.yml +++ b/.github/workflows/electron-build.yml @@ -67,7 +67,7 @@ jobs: VERSION=$(git describe --tags) VERSION=${VERSION#v} # Remove 'v' prefix if present # Convert to valid semver: take first 3 components and convert rest to prerelease format - # e.g., 0.9.0.9.1-50-g7074ea2e -> 0.9.0-dev.9.1.50.g7074ea2e + # e.g., 0.9.3-patch.1 -> 0.9.3-patch.1 if [[ $VERSION =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$ ]]; then MAJOR=${BASH_REMATCH[1]} MINOR=${BASH_REMATCH[2]} @@ -76,17 +76,9 @@ jobs: VERSION="$MAJOR.$MINOR.$PATCH" - # If there's extra content, parse and convert to prerelease format + # If there's extra content, append it without adding -dev if [[ -n "$REST" ]]; then - if [[ $REST =~ ^(\..*)?(-[0-9]+-g[0-9a-f]+)$ ]]; then - EXTRA=${BASH_REMATCH[1]} - GIT_SUFFIX=${BASH_REMATCH[2]} - VERSION="$VERSION-dev" - [[ -n "$EXTRA" ]] && VERSION="$VERSION${EXTRA//./.}" - [[ -n "$GIT_SUFFIX" ]] && VERSION="$VERSION${GIT_SUFFIX//-/.}" - else - VERSION="$VERSION-dev${REST//./.}" - fi + VERSION="$VERSION$REST" fi fi npm version $VERSION --no-git-tag-version --allow-same-version diff --git a/electron/package.json b/electron/package.json index 4b5880ea..d28ef73b 100644 --- a/electron/package.json +++ b/electron/package.json @@ -30,7 +30,7 @@ }, "build": { "appId": "com.newapi.desktop", - "productName": "New API", + "productName": "New-API-App", "publish": null, "directories": { "output": "dist"