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