diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml
index 8becc02..c31fcda 100644
--- a/.gitea/workflows/release.yaml
+++ b/.gitea/workflows/release.yaml
@@ -59,16 +59,17 @@ jobs:
- name: Create Release Archive
run: |
VERSION=${GITHUB_REF#refs/tags/}
+ VERSION_NUM=${VERSION#v} # Remove 'v' prefix (e.g., v0.1.4 -> 0.1.4)
mkdir -p release
- # Copy AppImage (if it exists)
- if [ -f publish/appimage/NotePad-0.1.0-x86_64.AppImage ]; then
- cp publish/appimage/NotePad-0.1.0-x86_64.AppImage \
+ # Copy AppImage (if it exists) - use version from build
+ if [ -f publish/appimage/NotePad-${VERSION_NUM}-x86_64.AppImage ]; then
+ cp publish/appimage/NotePad-${VERSION_NUM}-x86_64.AppImage \
release/NotePad-${VERSION}-x86_64.AppImage
fi
# Copy Linux Tarball
- cp publish/tarball/notepad-0.1.0-linux-x64.tar.gz \
+ cp publish/tarball/notepad-${VERSION_NUM}-linux-x64.tar.gz \
release/notepad-${VERSION}-linux-x64.tar.gz
# Create Windows zip
diff --git a/NotePad/NotePad.csproj b/NotePad/NotePad.csproj
index d13cd15..cc68354 100644
--- a/NotePad/NotePad.csproj
+++ b/NotePad/NotePad.csproj
@@ -6,6 +6,7 @@
app.manifest
true
img\notepad-icon.ico
+ 0.1.5
diff --git a/NotePad/build-appimage.sh b/NotePad/build-appimage.sh
index 303a92a..3805f24 100755
--- a/NotePad/build-appimage.sh
+++ b/NotePad/build-appimage.sh
@@ -5,7 +5,7 @@
set -e
APP_NAME="NotePad"
-VERSION="0.1.0"
+VERSION="${1:-0.1.0}" # Use first argument or default to 0.1.0
ARCH="x86_64"
# Directories
diff --git a/NotePad/publish.py b/NotePad/publish.py
index b1f59b5..023ff65 100644
--- a/NotePad/publish.py
+++ b/NotePad/publish.py
@@ -9,9 +9,30 @@ import sys
import os
import shutil
import tarfile
+import xml.etree.ElementTree as ET
from pathlib import Path
+def get_version():
+ """Extract version from .csproj file"""
+ csproj_path = Path("NotePad.csproj")
+ if not csproj_path.exists():
+ print("⚠️ WARNING: NotePad.csproj not found. Using default version 0.1.0")
+ return "0.1.0"
+
+ try:
+ tree = ET.parse(csproj_path)
+ root = tree.getroot()
+ version_elem = root.find(".//Version")
+ if version_elem is not None and version_elem.text:
+ return version_elem.text
+ print("⚠️ WARNING: Version not found in .csproj. Using default version 0.1.0")
+ return "0.1.0"
+ except Exception as e:
+ print(f"⚠️ WARNING: Failed to parse .csproj: {e}. Using default version 0.1.0")
+ return "0.1.0"
+
+
def run_command(cmd, description):
"""Run a shell command and print status"""
print(f"\n{'=' * 60}")
@@ -69,7 +90,7 @@ def build_windows_installer():
print(f"\n⚠️ WARNING: Failed to create installer: {e}")
-def build_linux_tarball():
+def build_linux_tarball(version):
"""Create tar.gz archive with install script"""
print(f"\n{'=' * 60}")
print("Creating Linux tar.gz archive")
@@ -100,8 +121,13 @@ def build_linux_tarball():
shutil.copy(script_path, temp_dir / "notepad" / script)
os.chmod(temp_dir / "notepad" / script, 0o755)
+ # Copy img directory (contains icon)
+ img_dir = Path("img")
+ if img_dir.exists():
+ shutil.copytree(img_dir, temp_dir / "notepad" / "img")
+
# Create tar.gz
- tarball_path = tarball_dir / "notepad-0.1.0-linux-x64.tar.gz"
+ tarball_path = tarball_dir / f"notepad-{version}-linux-x64.tar.gz"
with tarfile.open(tarball_path, "w:gz") as tar:
tar.add(temp_dir / "notepad", arcname="notepad")
@@ -116,7 +142,7 @@ def build_linux_tarball():
print(f" sudo ./install.sh")
-def build_linux_appimage():
+def build_linux_appimage(version):
"""Build Linux AppImage"""
build_script = Path("build-appimage.sh")
if not build_script.exists():
@@ -125,7 +151,7 @@ def build_linux_appimage():
try:
result = subprocess.run(
- ["bash", str(build_script)],
+ ["bash", str(build_script), version],
capture_output=True,
text=True
)
@@ -190,10 +216,11 @@ def publish_platform(platform, linux_package='both'):
# Build Linux packages
if platform == 'linux':
+ version = get_version()
if linux_package in ['appimage', 'both']:
- build_linux_appimage()
+ build_linux_appimage(version)
if linux_package in ['tarball', 'both']:
- build_linux_tarball()
+ build_linux_tarball(version)
def main():