Skip to content

Commit

Permalink
provide the catalina installation package separately
Browse files Browse the repository at this point in the history
  • Loading branch information
pompurin404 committed Oct 16, 2024
1 parent caefbe9 commit bf3972b
Show file tree
Hide file tree
Showing 7 changed files with 102 additions and 19 deletions.
57 changes: 54 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,56 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }}

macos:
strategy:
fail-fast: false
matrix:
arch:
- x64
- arm64
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup pnpm
run: npm install -g pnpm
- name: Install Dependencies
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: |
pnpm install
pnpm add @mihomo-party/sysproxy-darwin-${{ matrix.arch }}
pnpm prepare --${{ matrix.arch }}
- name: Build
env:
npm_config_arch: ${{ matrix.arch }}
npm_config_target_arch: ${{ matrix.arch }}
run: |
sed -i "" -e "s/productName: mihomo-party/productName: Mihomo Party/" electron-builder.yml
chmod +x build/pkg-scripts/postinstall
pnpm build:mac --${{ matrix.arch }}
- name: Generate checksums
run: pnpm checksum .pkg
- name: Upload Artifacts
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: MacOS ${{ matrix.arch }}
path: |
dist/*.sha256
dist/*.pkg
if-no-files-found: error
- name: Publish Release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.sha256
dist/*.pkg
body_path: changelog.md
token: ${{ secrets.GITHUB_TOKEN }}

macos10:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -199,6 +249,7 @@ jobs:
npm_config_target_arch: ${{ matrix.arch }}
run: |
sed -i "" -e "s/productName: mihomo-party/productName: Mihomo Party/" electron-builder.yml
sed -i "" -e "s/macos/catalina/" electron-builder.yml
chmod +x build/pkg-scripts/postinstall
pnpm build:mac --${{ matrix.arch }}
- name: Generate checksums
Expand All @@ -224,7 +275,7 @@ jobs:

artifact:
if: startsWith(github.ref, 'refs/heads/')
needs: [windows, macos, linux, windows7]
needs: [windows, macos, linux, windows7, macos10]
runs-on: ubuntu-latest
services:
telegram-bot-api:
Expand Down Expand Up @@ -252,7 +303,7 @@ jobs:

updater:
if: startsWith(github.ref, 'refs/tags/v')
needs: [windows, macos, windows7]
needs: [windows, macos, windows7, macos10]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down Expand Up @@ -361,7 +412,7 @@ jobs:
homebrew:
if: startsWith(github.ref, 'refs/tags/v')
name: Update Homebrew cask
needs: macos
needs: [macos, macos10]
runs-on: macos-latest
steps:
- name: Set up Git
Expand Down
11 changes: 2 additions & 9 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
### Breaking Changes

- macOS 改用 pkg 安装方式,不再支持 dmg 安装方式,因此本次更新需要手动下载安装包进行安装

### New Features

- macOS/Linux 均不再存储 root 密码

### Bug Fixes

- 修复 macOS 10.15 无法安装的问题
- 1.5.0 之后 macOS 改用 pkg 安装方式,不再支持 dmg 安装方式,因此本次更新需要手动下载安装包进行安装
- electron33 已不再支持 macOS 10.15,故为 10.15 提供单独的安装包,需要的用户请自行下载安装,应用内更新时会自动检测系统版本,安装后后续可正常在应用内直接更新
1 change: 0 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ nsis:
mac:
target:
- pkg
minimumSystemVersion: '10.15'
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
Expand Down
29 changes: 28 additions & 1 deletion scripts/artifact.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ const macosFiles = [
path.join(GITHUB_WORKSPACE, `mihomo-party-macos-${version}-x64.pkg`)
]

const macos10Files = [
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-arm64.pkg`),
path.join(GITHUB_WORKSPACE, `mihomo-party-catalina-${version}-x64.pkg`)
]

const windowsFiles = [
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-x64-setup.exe`),
path.join(GITHUB_WORKSPACE, `mihomo-party-windows-${version}-x64-portable.7z`),
Expand Down Expand Up @@ -80,14 +85,26 @@ const macosMedia = macosFiles.map((file, index) => ({
type: 'document',
media: `attach://file${index}`
}))
macosMedia[macosMedia.length - 1].caption = `#${hash} #macOS\n${message}`
macosMedia[macosMedia.length - 1].caption = `#${hash} #macOS 11+\n${message}`
const macosForm = new FormData()
macosForm.append('chat_id', CHAT_ID)
macosForm.append('media', JSON.stringify(macosMedia))
macosFiles.forEach((file, index) => {
macosForm.append(`file${index}`, fs.createReadStream(file))
})

const macos10Media = macos10Files.map((file, index) => ({
type: 'document',
media: `attach://file${index}`
}))
macos10Media[macos10Media.length - 1].caption = `#${hash} #macOS 10.15+\n${message}`
const macos10Form = new FormData()
macos10Form.append('chat_id', CHAT_ID)
macos10Form.append('media', JSON.stringify(macos10Media))
macos10Files.forEach((file, index) => {
macos10Form.append(`file${index}`, fs.createReadStream(file))
})

function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms))
}
Expand Down Expand Up @@ -122,6 +139,16 @@ await axios.post(

await sleep(10000)

await axios.post(
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
macos10Form,
{
headers: macos10Form.getHeaders()
}
)

await sleep(10000)

await axios.post(
`http://127.0.0.1:8081/bot${process.env.TELEGRAM_BOT_TOKEN}/sendMediaGroup`,
linuxForm,
Expand Down
7 changes: 5 additions & 2 deletions scripts/telegram.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ content += `便携版:<a href="${downloadUrl}/mihomo-party-windows-${version}-
content += '\n<b>Windows7/8:</b>\n'
content += `安装版:<a href="${downloadUrl}/mihomo-party-win7-${version}-x64-setup.exe">64位</a> | <a href="${downloadUrl}/mihomo-party-win7-${version}-ia32-setup.exe">32位</a>\n`
content += `便携版:<a href="${downloadUrl}/mihomo-party-win7-${version}-x64-portable.7z">64位</a> | <a href="${downloadUrl}/mihomo-party-win7-${version}-ia32-portable.7z">32位</a>\n`
content += '\n<b>macOS:</b>\n'
content += `DMG:<a href="${downloadUrl}/mihomo-party-macos-${version}-x64.pkg
content += '\n<b>macOS 11+:</b>\n'
content += `PKG:<a href="${downloadUrl}/mihomo-party-macos-${version}-x64.pkg
">Intel</a> | <a href="${downloadUrl}/mihomo-party-macos-${version}-arm64.pkg">Apple Silicon</a>\n`
content += '\n<b>macOS 10.15+:</b>\n'
content += `PKG:<a href="${downloadUrl}/mihomo-party-catalina-${version}-x64.pkg
">Intel</a> | <a href="${downloadUrl}/mihomo-party-catalina-${version}-arm64.pkg">Apple Silicon</a>\n`
content += '\n<b>Linux:</b>\n'
content += `DEB:<a href="${downloadUrl}/mihomo-party-linux-${version}-amd64.deb
">64位</a> | <a href="${downloadUrl}/mihomo-party-linux-${version}-arm64.deb">ARM64</a>\n`
Expand Down
6 changes: 4 additions & 2 deletions scripts/updater.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ changelog += `- 便携版:[64位](${downloadUrl}/mihomo-party-windows-${versio
changelog += '\n#### Windows7/8:\n\n'
changelog += `- 安装版:[64位](${downloadUrl}/mihomo-party-win7-${version}-x64-setup.exe) | [32位](${downloadUrl}/mihomo-party-win7-${version}-ia32-setup.exe)\n\n`
changelog += `- 便携版:[64位](${downloadUrl}/mihomo-party-win7-${version}-x64-portable.7z) | [32位](${downloadUrl}/mihomo-party-win7-${version}-ia32-portable.7z)\n\n`
changelog += '\n#### macOS:\n\n'
changelog += `- DMG:[Intel](${downloadUrl}/mihomo-party-macos-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-macos-${version}-arm64.pkg)\n\n`
changelog += '\n#### macOS 11+:\n\n'
changelog += `- PKG:[Intel](${downloadUrl}/mihomo-party-macos-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-macos-${version}-arm64.pkg)\n\n`
changelog += '\n#### macOS 10.15+:\n\n'
changelog += `- PKG:[Intel](${downloadUrl}/mihomo-party-catalina-${version}-x64.pkg) | [Apple Silicon](${downloadUrl}/mihomo-party-catalina-${version}-arm64.pkg)\n\n`
changelog += '\n#### Linux:\n\n'
changelog += `- DEB:[64位](${downloadUrl}/mihomo-party-linux-${version}-amd64.deb) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-arm64.deb)\n\n`
changelog += `- RPM:[64位](${downloadUrl}/mihomo-party-linux-${version}-x86_64.rpm) | [ARM64](${downloadUrl}/mihomo-party-linux-${version}-aarch64.rpm)`
Expand Down
10 changes: 9 additions & 1 deletion src/main/resolve/autoUpdater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { copyFile, rm, writeFile } from 'fs/promises'
import path from 'path'
import { existsSync } from 'fs'
import os from 'os'
import { exec, spawn } from 'child_process'
import { exec, execSync, spawn } from 'child_process'
import { promisify } from 'util'

export async function checkUpdate(): Promise<IAppVersion | undefined> {
Expand Down Expand Up @@ -52,6 +52,14 @@ export async function downloadAndInstallUpdate(version: string): Promise<void> {
if (process.platform === 'win32' && parseInt(os.release()) < 10) {
file = file.replace('windows', 'win7')
}
if (process.platform === 'darwin') {
const productVersion = execSync('sw_vers -productVersion', { encoding: 'utf8' })
.toString()
.trim()
if (parseInt(productVersion) < 11) {
file = file.replace('macos', 'catalina')
}
}
try {
if (!existsSync(path.join(dataDir(), file))) {
const res = await axios.get(`${baseUrl}${file}`, {
Expand Down

0 comments on commit bf3972b

Please sign in to comment.