@@ -8,15 +8,38 @@ echo "============================================"
88echo " Creating macOS DMG Installer"
99echo " ============================================"
1010
11- # Get version and architecture
11+ # Get version (prefer GITHUB_REF_NAME, then pyproject.toml, then git tag, then default)
1212if [ -n " ${GITHUB_REF_NAME:- } " ]; then
1313 VERSION=" ${GITHUB_REF_NAME# v} "
1414else
15- VERSION=$( git describe --tags --abbrev=0 2> /dev/null | sed ' s/^v//' || echo " 3.0.4" )
15+ VERSION=$(
16+ python3 - << 'PY '
17+ import sys, subprocess
18+ try:
19+ import tomllib
20+ with open("pyproject.toml","rb") as f:
21+ cfg = tomllib.load(f)
22+ v = cfg.get("project",{}).get("version")
23+ if v:
24+ print(v); sys.exit(0)
25+ except Exception:
26+ pass
27+ try:
28+ tag = subprocess.check_output(["git","describe","--tags","--abbrev=0"], stderr=subprocess.DEVNULL).decode().strip()
29+ print(tag.lstrip("v")); sys.exit(0)
30+ except Exception:
31+ print("3.0.4")
32+ PY
33+ )
1634fi
1735
36+ # sanitize VERSION for filenames
37+ VERSION_SAFE=" ${VERSION// \/ / -} "
38+ VERSION_SAFE=" ${VERSION_SAFE// / -} "
39+ VERSION_SAFE=" $( echo " $VERSION_SAFE " | tr -cd ' A-Za-z0-9._-' ) "
40+
1841ARCH=$( uname -m)
19- echo " Version: ${VERSION} "
42+ echo " Version: ${VERSION} (safe: ${VERSION_SAFE} ) "
2043echo " Architecture: ${ARCH} "
2144
2245# Verify single-file executable exists
@@ -82,7 +105,7 @@ if [ -f "LICENSE" ]; then
82105fi
83106
84107# Create DMG
85- DMG_NAME=" pyprophet-${VERSION } -macos-${ARCH} .dmg"
108+ DMG_NAME=" pyprophet-${VERSION_SAFE } -macos-${ARCH} .dmg"
86109echo " Creating DMG: ${DMG_NAME} "
87110
88111# Remove any existing DMG
0 commit comments