test: add workflow for building macOS DMG (arm64) with dynamic version input

This commit is contained in:
Bohdan Triapitsyn
2026-01-30 11:08:31 +02:00
parent a1ed55d3f5
commit ab431a04a6
2 changed files with 26 additions and 25 deletions
@@ -1,4 +1,4 @@
name: Build macOS 15 DMG (arm64)
name: Build macOS DMG (arm64)
on:
workflow_dispatch:
@@ -22,6 +22,7 @@ env:
jobs:
build-macos-dmg-arm64:
name: Build DMG (arm64, ${{ inputs.macos_version }})
runs-on: ${{ inputs.macos_version }}
steps:
- name: Checkout
@@ -109,7 +110,7 @@ jobs:
DMG_PATH="packages/desktop/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*.dmg"
if ls $DMG_PATH 1> /dev/null 2>&1; then
DMG_FILE=$(ls $DMG_PATH | head -n 1)
DMG_NAME="OpenChamber_macos15_arm64.dmg"
DMG_NAME="OpenChamber_${{ inputs.macos_version }}_arm64.dmg"
cp "$DMG_FILE" "artifacts/$DMG_NAME"
else
echo "Error: DMG file not found at $DMG_PATH"
@@ -119,6 +120,6 @@ jobs:
- name: Upload DMG artifact
uses: actions/upload-artifact@v4
with:
name: macos15-dmg-arm64
name: dmg-${{ inputs.macos_version }}-arm64
path: artifacts/*.dmg
retention-days: 7
+22 -22
View File
@@ -80,7 +80,7 @@ jobs:
build-desktop-macos:
needs: create-release
runs-on: macos-15
runs-on: macos-26
strategy:
fail-fast: false
matrix:
@@ -220,7 +220,7 @@ jobs:
run: |
mkdir -p artifacts
VERSION="${{ needs.create-release.outputs.version }}"
# Copy DMG (Tauri names it with the target triple in the path)
DMG_PATH="packages/desktop/src-tauri/target/${{ matrix.target }}/release/bundle/dmg/*.dmg"
if ls $DMG_PATH 1> /dev/null 2>&1; then
@@ -231,11 +231,11 @@ jobs:
echo "Error: DMG file not found at $DMG_PATH"
exit 1
fi
# Copy tar.gz and signature for updater
TAR_PATH="packages/desktop/src-tauri/target/${{ matrix.target }}/release/bundle/macos/*.tar.gz"
SIG_PATH="packages/desktop/src-tauri/target/${{ matrix.target }}/release/bundle/macos/*.tar.gz.sig"
if ls $TAR_PATH 1> /dev/null 2>&1; then
TAR_FILE=$(ls $TAR_PATH | head -n 1)
TAR_BASE=$(basename "$TAR_FILE")
@@ -245,7 +245,7 @@ jobs:
echo "Error: tar.gz file not found at $TAR_PATH"
exit 1
fi
if ls $SIG_PATH 1> /dev/null 2>&1; then
SIG_FILE=$(ls $SIG_PATH | head -n 1)
SIG_BASE=$(basename "$SIG_FILE")
@@ -255,14 +255,14 @@ jobs:
echo "Error: signature file not found at $SIG_PATH"
exit 1
fi
echo "Successfully prepared artifacts:"
ls -lh artifacts/
- name: Generate update manifest
run: |
VERSION="${{ needs.create-release.outputs.version }}"
# Find the signature file for this platform
SIG_FILE=$(find artifacts -name "*-${{ matrix.platform }}.tar.gz.sig" | head -1)
if [ -f "$SIG_FILE" ]; then
@@ -270,11 +270,11 @@ jobs:
else
SIGNATURE=""
fi
# Find the tar.gz file name for this platform
TAR_FILE=$(find artifacts -name "*-${{ matrix.platform }}.tar.gz" ! -name "*.sig" | head -1)
TAR_NAME=$(basename "$TAR_FILE" 2>/dev/null || echo "OpenChamber-${{ matrix.platform }}.app.tar.gz")
cat > artifacts/latest-${{ matrix.platform }}.json << EOF
{
"version": "${VERSION}",
@@ -288,7 +288,7 @@ jobs:
}
}
EOF
echo "Generated latest-${{ matrix.platform }}.json:"
cat artifacts/latest-${{ matrix.platform }}.json
@@ -303,7 +303,7 @@ jobs:
artifacts/latest-${{ matrix.platform }}.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload manifest as artifact
uses: actions/upload-artifact@v4
with:
@@ -360,52 +360,52 @@ jobs:
with:
name: manifest-darwin-aarch64
path: artifacts
- name: Download x86_64 manifest
uses: actions/download-artifact@v4
with:
name: manifest-darwin-x86_64
path: artifacts
- name: Combine manifests
run: |
VERSION="${{ needs.create-release.outputs.version }}"
PUB_DATE="$(date -u +%Y-%m-%dT%H:%M:%SZ)"
REPO="${{ github.repository }}"
# Validate that both manifest files exist and are valid JSON
if [ ! -f artifacts/latest-darwin-aarch64.json ]; then
echo "Error: aarch64 manifest not found"
exit 1
fi
if [ ! -f artifacts/latest-darwin-x86_64.json ]; then
echo "Error: x86_64 manifest not found"
exit 1
fi
# Validate JSON structure
if ! jq empty artifacts/latest-darwin-aarch64.json 2>/dev/null; then
echo "Error: aarch64 manifest is not valid JSON"
exit 1
fi
if ! jq empty artifacts/latest-darwin-x86_64.json 2>/dev/null; then
echo "Error: x86_64 manifest is not valid JSON"
exit 1
fi
# Validate platform data exists in manifests
if ! jq -e '.platforms["darwin-aarch64"]' artifacts/latest-darwin-aarch64.json > /dev/null; then
echo "Error: darwin-aarch64 platform data not found in manifest"
exit 1
fi
if ! jq -e '.platforms["darwin-x86_64"]' artifacts/latest-darwin-x86_64.json > /dev/null; then
echo "Error: darwin-x86_64 platform data not found in manifest"
exit 1
fi
# Use jq to properly combine the manifests
jq -n \
--arg version "$VERSION" \
@@ -422,10 +422,10 @@ jobs:
"darwin-x86_64": $x86_64[0].platforms["darwin-x86_64"]
}
}' > artifacts/latest.json
echo "Generated combined latest.json:"
cat artifacts/latest.json
- name: Upload combined manifest
uses: softprops/action-gh-release@v2
with: