mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 09:19:56 -05:00
[V1] MacOS-Patch & Fixes (WIP)
This commit is contained in:
@@ -8,7 +8,6 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build frontend on Ubuntu (cheaper) and share via artifact
|
|
||||||
frontend:
|
frontend:
|
||||||
name: Build frontend
|
name: Build frontend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@@ -37,9 +36,8 @@ jobs:
|
|||||||
path: dist/
|
path: dist/
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
# Both arch builds on one runner to avoid runner availability issues
|
|
||||||
tauri:
|
tauri:
|
||||||
name: Tauri (macOS universal)
|
name: Tauri (macOS)
|
||||||
needs: frontend
|
needs: frontend
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
permissions:
|
permissions:
|
||||||
@@ -73,24 +71,16 @@ jobs:
|
|||||||
node-version: 22
|
node-version: 22
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
# node_modules needed so tauri-cli is available on the runner
|
|
||||||
- name: Install JS dependencies
|
- name: Install JS dependencies
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
# bun being present causes tauri-action to misdetect the package manager;
|
|
||||||
# unlink it if present (it may not be installed on all runner images)
|
|
||||||
- name: Remove bun if present
|
|
||||||
run: which bun && brew uninstall --ignore-dependencies bun || true
|
|
||||||
|
|
||||||
# Import Apple signing cert into a fresh keychain so codesign can find it.
|
|
||||||
# If secrets are not set this step is a no-op and the build continues unsigned.
|
|
||||||
- name: Import Apple signing certificate
|
- name: Import Apple signing certificate
|
||||||
env:
|
env:
|
||||||
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
|
||||||
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
|
||||||
run: |
|
run: |
|
||||||
if [ -z "$APPLE_CERTIFICATE" ]; then
|
if [ -z "$APPLE_CERTIFICATE" ]; then
|
||||||
echo "No certificate set — building unsigned."
|
echo "No certificate configured — building unsigned."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
CERT_PATH=$RUNNER_TEMP/certificate.p12
|
CERT_PATH=$RUNNER_TEMP/certificate.p12
|
||||||
@@ -104,20 +94,16 @@ jobs:
|
|||||||
security set-key-partition-list -S apple-tool:,apple: -k "" "$KEYCHAIN_PATH"
|
security set-key-partition-list -S apple-tool:,apple: -k "" "$KEYCHAIN_PATH"
|
||||||
security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain
|
security list-keychains -d user -s "$KEYCHAIN_PATH" login.keychain
|
||||||
|
|
||||||
# Download both Suwayomi arch binaries up front
|
|
||||||
- name: Download Suwayomi binaries
|
- name: Download Suwayomi binaries
|
||||||
run: |
|
run: |
|
||||||
download_suwayomi() {
|
download_suwayomi() {
|
||||||
local asset="$1"
|
local asset="$1" sha="$2" outdir="$3"
|
||||||
local expected_sha="$2"
|
|
||||||
local out="$3"
|
|
||||||
|
|
||||||
curl -fsSL \
|
curl -fsSL \
|
||||||
"https://github.com/Suwayomi/Suwayomi-Server/releases/download/v2.1.1867/${asset}" \
|
"https://github.com/Suwayomi/Suwayomi-Server/releases/download/v2.1.1867/${asset}" \
|
||||||
-o "${out}.tar.gz"
|
-o "${outdir}.tar.gz"
|
||||||
echo "${expected_sha} ${out}.tar.gz" | shasum -a 256 -c -
|
echo "${sha} ${outdir}.tar.gz" | shasum -a 256 -c -
|
||||||
mkdir -p "${out}"
|
mkdir -p "${outdir}"
|
||||||
tar -xzf "${out}.tar.gz" -C "${out}" --strip-components=1
|
tar -xzf "${outdir}.tar.gz" -C "${outdir}" --strip-components=1
|
||||||
}
|
}
|
||||||
|
|
||||||
download_suwayomi \
|
download_suwayomi \
|
||||||
@@ -136,21 +122,14 @@ jobs:
|
|||||||
|
|
||||||
find_launcher() {
|
find_launcher() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local result
|
find "$dir" -maxdepth 1 -type f -name "Suwayomi-Server" | head -1
|
||||||
|
|
||||||
result=$(find "$dir" -maxdepth 1 -type f -name "Suwayomi-Server" | head -1)
|
|
||||||
if [ -z "$result" ]; then
|
|
||||||
result=$(find "$dir" -maxdepth 1 -type f -perm +111 \
|
|
||||||
! -name "*.jar" ! -name "*.dylib" | head -1)
|
|
||||||
fi
|
|
||||||
echo "$result"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ARM_LAUNCHER=$(find_launcher suwayomi-arm64)
|
ARM_LAUNCHER=$(find_launcher suwayomi-arm64)
|
||||||
X64_LAUNCHER=$(find_launcher suwayomi-x64)
|
X64_LAUNCHER=$(find_launcher suwayomi-x64)
|
||||||
|
|
||||||
if [ -z "$ARM_LAUNCHER" ] || [ -z "$X64_LAUNCHER" ]; then
|
if [ -z "$ARM_LAUNCHER" ] || [ -z "$X64_LAUNCHER" ]; then
|
||||||
echo "ERROR: could not find launchers"
|
echo "ERROR: could not find launchers — tarball contents:"
|
||||||
ls -lR suwayomi-arm64 suwayomi-x64
|
ls -lR suwayomi-arm64 suwayomi-x64
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -163,12 +142,9 @@ jobs:
|
|||||||
chmod +x src-tauri/binaries/suwayomi-server-aarch64-apple-darwin
|
chmod +x src-tauri/binaries/suwayomi-server-aarch64-apple-darwin
|
||||||
chmod +x src-tauri/binaries/suwayomi-server-x86_64-apple-darwin
|
chmod +x src-tauri/binaries/suwayomi-server-x86_64-apple-darwin
|
||||||
|
|
||||||
# Bundle the full extracted dirs so launchers can find their JDK+JAR
|
|
||||||
# at runtime via relative paths inside the .app Resources directory.
|
|
||||||
cp -r suwayomi-arm64 src-tauri/binaries/suwayomi-bundle-arm64
|
cp -r suwayomi-arm64 src-tauri/binaries/suwayomi-bundle-arm64
|
||||||
cp -r suwayomi-x64 src-tauri/binaries/suwayomi-bundle-x64
|
cp -r suwayomi-x64 src-tauri/binaries/suwayomi-bundle-x64
|
||||||
|
|
||||||
# Build arm64 first, then x64 — sequential on the same runner
|
|
||||||
- name: Build Tauri app (aarch64)
|
- name: Build Tauri app (aarch64)
|
||||||
uses: tauri-apps/tauri-action@v0
|
uses: tauri-apps/tauri-action@v0
|
||||||
env:
|
env:
|
||||||
@@ -180,9 +156,7 @@ jobs:
|
|||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
with:
|
with:
|
||||||
args: >
|
args: --target aarch64-apple-darwin --config src-tauri/tauri.macos.conf.json
|
||||||
--target aarch64-apple-darwin
|
|
||||||
--config '{"build":{"beforeBuildCommand":""},"bundle":{"targets":["dmg","macos"]}}'
|
|
||||||
|
|
||||||
- name: Build Tauri app (x86_64)
|
- name: Build Tauri app (x86_64)
|
||||||
uses: tauri-apps/tauri-action@v0
|
uses: tauri-apps/tauri-action@v0
|
||||||
@@ -195,9 +169,7 @@ jobs:
|
|||||||
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
with:
|
with:
|
||||||
args: >
|
args: --target x86_64-apple-darwin --config src-tauri/tauri.macos.conf.json
|
||||||
--target x86_64-apple-darwin
|
|
||||||
--config '{"build":{"beforeBuildCommand":""},"bundle":{"targets":["dmg","macos"]}}'
|
|
||||||
|
|
||||||
- name: Upload arm64 .dmg
|
- name: Upload arm64 .dmg
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
@@ -227,7 +199,6 @@ jobs:
|
|||||||
path: src-tauri/target/x86_64-apple-darwin/release/bundle/macos/
|
path: src-tauri/target/x86_64-apple-darwin/release/bundle/macos/
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
# lipo the two .app bundles into a single universal .dmg
|
|
||||||
universal:
|
universal:
|
||||||
name: Universal .dmg
|
name: Universal .dmg
|
||||||
needs: tauri
|
needs: tauri
|
||||||
@@ -252,9 +223,6 @@ jobs:
|
|||||||
X64_APP=$(find apps/x64 -name "*.app" -maxdepth 1 | head -1)
|
X64_APP=$(find apps/x64 -name "*.app" -maxdepth 1 | head -1)
|
||||||
APP_NAME=$(basename "$ARM_APP")
|
APP_NAME=$(basename "$ARM_APP")
|
||||||
|
|
||||||
echo "arm64: $ARM_APP"
|
|
||||||
echo "x64: $X64_APP"
|
|
||||||
|
|
||||||
mkdir -p universal
|
mkdir -p universal
|
||||||
cp -r "$ARM_APP" "universal/${APP_NAME}"
|
cp -r "$ARM_APP" "universal/${APP_NAME}"
|
||||||
|
|
||||||
@@ -273,12 +241,10 @@ jobs:
|
|||||||
mkdir dmg-stage
|
mkdir dmg-stage
|
||||||
cp -r "universal/${APP_NAME}" dmg-stage/
|
cp -r "universal/${APP_NAME}" dmg-stage/
|
||||||
ln -s /Applications dmg-stage/Applications
|
ln -s /Applications dmg-stage/Applications
|
||||||
|
|
||||||
hdiutil create \
|
hdiutil create \
|
||||||
-volname "Moku" \
|
-volname "Moku" \
|
||||||
-srcfolder dmg-stage \
|
-srcfolder dmg-stage \
|
||||||
-ov \
|
-ov -format UDZO \
|
||||||
-format UDZO \
|
|
||||||
"moku-universal.dmg"
|
"moku-universal.dmg"
|
||||||
|
|
||||||
- name: Upload universal .dmg
|
- name: Upload universal .dmg
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"build": {
|
||||||
|
"beforeBuildCommand": ""
|
||||||
|
},
|
||||||
|
"bundle": {
|
||||||
|
"targets": ["dmg", "macos"]
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user