Skip to content

Commit fdd1380

Browse files
fix: refine version handling in CI workflow to differentiate artifact versioning and improve error handling for app packaging
1 parent a8089cf commit fdd1380

1 file changed

Lines changed: 60 additions & 14 deletions

File tree

.github/workflows/release.yml

Lines changed: 60 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ permissions:
1010
contents: write
1111

1212
env:
13-
# Derived from tag at runtime (e.g. v1.0.3 -> 1.0.3)
13+
# RELEASE_VERSION: git ref label (branch name or tag without v). ARTIFACT_VERSION: safe semver for filenames.
1414
RELEASE_VERSION: ""
15+
ARTIFACT_VERSION: ""
1516
# Starting port written into engine-config.json in CI (engine may increment).
1617
ENGINE_PORT: "8740"
1718

@@ -27,9 +28,18 @@ jobs:
2728
shell: pwsh
2829
run: |
2930
$ref = "${env:GITHUB_REF_NAME}"
30-
if ($ref -like "v*") { $ver = $ref.Substring(1) } else { $ver = $ref }
31+
$run = "${env:GITHUB_RUN_NUMBER}"
32+
if ($ref -like "v*") {
33+
$ver = $ref.Substring(1)
34+
$artifactVer = $ver
35+
} else {
36+
$ver = $ref
37+
# Branch/manual runs: avoid vmain in installer names; keep unique per workflow run.
38+
$artifactVer = "0.0.0.$run"
39+
}
3140
"RELEASE_VERSION=$ver" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
32-
Write-Host "Release version: $ver"
41+
"ARTIFACT_VERSION=$artifactVer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
42+
Write-Host "Release version: $ver (artifact files: v$artifactVer)"
3343
3444
- name: Setup Python
3545
uses: actions/setup-python@v5
@@ -60,10 +70,11 @@ jobs:
6070
(Get-Content "engine/api/server.py") `
6171
-replace 'version=\"[^\"]+\"', "version=`"$ver`"" `
6272
| Set-Content "engine/api/server.py"
63-
# Inno Setup version + output name
73+
# Inno Setup version + output name (use ARTIFACT_VERSION so branch runs are not vmain)
74+
$artifactVer = "${env:ARTIFACT_VERSION}"
6475
(Get-Content "installer/sentracore.iss") `
6576
-replace '^AppVersion=.*$', "AppVersion=$pubVer" `
66-
-replace '^OutputBaseFilename=.*$', "OutputBaseFilename=SentraCore_Setup_v$ver" `
77+
-replace '^OutputBaseFilename=.*$', "OutputBaseFilename=SentraCore_Setup_v$artifactVer" `
6778
| Set-Content "installer/sentracore.iss"
6879
6980
- name: Create venv + install engine deps
@@ -180,9 +191,17 @@ jobs:
180191
- name: Derive version from tag
181192
run: |
182193
REF="${GITHUB_REF_NAME}"
183-
if [[ "$REF" == v* ]]; then VER="${REF:1}"; else VER="$REF"; fi
194+
RUN="${GITHUB_RUN_NUMBER:-0}"
195+
if [[ "$REF" == v* ]]; then
196+
VER="${REF:1}"
197+
ART="$VER"
198+
else
199+
VER="$REF"
200+
ART="0.0.0.${RUN}"
201+
fi
184202
echo "RELEASE_VERSION=$VER" >> "$GITHUB_ENV"
185-
echo "Release version: $VER"
203+
echo "ARTIFACT_VERSION=$ART" >> "$GITHUB_ENV"
204+
echo "Release version: $VER (artifact files: v$ART)"
186205
187206
- name: Setup Python
188207
uses: actions/setup-python@v5
@@ -296,17 +315,36 @@ jobs:
296315
297316
- name: Bundle engine into .app + sign (ad-hoc)
298317
run: |
299-
APP="$(ls dashboard/build/macos/Build/Products/Release/*.app | head -n 1)"
300-
test -d "$APP"
318+
set -euo pipefail
319+
RELEASE_DIR="dashboard/build/macos/Build/Products/Release"
320+
if [ ! -d "$RELEASE_DIR" ]; then
321+
echo "Missing Release dir: $RELEASE_DIR"
322+
exit 1
323+
fi
324+
APP="$(find "$RELEASE_DIR" -maxdepth 1 -name "*.app" -print -quit)"
325+
if [ -z "${APP}" ] || [ ! -d "$APP" ]; then
326+
echo "No .app bundle under $RELEASE_DIR — contents:"
327+
ls -la "$RELEASE_DIR" || true
328+
exit 1
329+
fi
330+
echo "Using app bundle: $APP"
301331
chmod +x dist/SentraCoreEngine
332+
codesign --force --sign - dist/SentraCoreEngine
302333
cp dist/SentraCoreEngine "$APP/Contents/MacOS/SentraCoreEngine"
303334
chmod +x "$APP/Contents/MacOS/SentraCoreEngine"
304335
codesign --force --deep --sign - "$APP"
305336
306337
- name: Package (zip)
307338
run: |
308-
APP="$(ls dashboard/build/macos/Build/Products/Release/*.app | head -n 1)"
309-
zip -r "SentraCore_macOS_${RELEASE_VERSION}.zip" "$APP"
339+
set -euo pipefail
340+
RELEASE_DIR="dashboard/build/macos/Build/Products/Release"
341+
APP="$(find "$RELEASE_DIR" -maxdepth 1 -name "*.app" -print -quit)"
342+
if [ -z "${APP}" ] || [ ! -d "$APP" ]; then
343+
echo "No .app bundle under $RELEASE_DIR"
344+
ls -la "$RELEASE_DIR" || true
345+
exit 1
346+
fi
347+
zip -r "SentraCore_macOS_${ARTIFACT_VERSION}.zip" "$APP"
310348
311349
- name: Upload macOS artifact
312350
uses: actions/upload-artifact@v4
@@ -323,9 +361,17 @@ jobs:
323361
- name: Derive version from tag
324362
run: |
325363
REF="${GITHUB_REF_NAME}"
326-
if [[ "$REF" == v* ]]; then VER="${REF:1}"; else VER="$REF"; fi
364+
RUN="${GITHUB_RUN_NUMBER:-0}"
365+
if [[ "$REF" == v* ]]; then
366+
VER="${REF:1}"
367+
ART="$VER"
368+
else
369+
VER="$REF"
370+
ART="0.0.0.${RUN}"
371+
fi
327372
echo "RELEASE_VERSION=$VER" >> "$GITHUB_ENV"
328-
echo "Release version: $VER"
373+
echo "ARTIFACT_VERSION=$ART" >> "$GITHUB_ENV"
374+
echo "Release version: $VER (artifact files: v$ART)"
329375
330376
- name: Install Linux desktop build deps
331377
run: |
@@ -512,7 +558,7 @@ jobs:
512558
513559
- name: Rename AppImage with version
514560
run: |
515-
mv SentraCore_linux.AppImage "SentraCore_linux_${RELEASE_VERSION}.AppImage"
561+
mv SentraCore_linux.AppImage "SentraCore_linux_${ARTIFACT_VERSION}.AppImage"
516562
517563
- name: Upload Linux artifact
518564
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)