Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b465706daa |
@@ -0,0 +1,189 @@
|
||||
name: Build iOS IPA
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ["main"]
|
||||
tags: ["v*"]
|
||||
|
||||
jobs:
|
||||
ios:
|
||||
name: iOS Build (IPA)
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
contents: write
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 对齐版本号
|
||||
id: ver
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
V="${GITHUB_REF_NAME#v}"
|
||||
else
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
fi
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
node -e "const fs=require('fs');for(const p of ['src-tauri/tauri.conf.json','package.json']){const j=JSON.parse(fs.readFileSync(p));j.version=process.argv[1];fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')}" "$V"
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-ios,aarch64-apple-ios-sim
|
||||
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri -> target
|
||||
key: ios-build
|
||||
|
||||
- name: 安装依赖
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: 初始化 iOS Xcode 工程
|
||||
run: |
|
||||
pnpm tauri ios init --ci || pnpm tauri ios init
|
||||
# 确保 iOS Info.plist(含 ~iphone / ~ipad 变体)支持横竖屏切换及 ATS
|
||||
for plist in $(find src-tauri/gen/apple -name "Info.plist" 2>/dev/null); do
|
||||
for key in "UISupportedInterfaceOrientations" "UISupportedInterfaceOrientations~iphone" "UISupportedInterfaceOrientations~ipad"; do
|
||||
/usr/libexec/PlistBuddy -c "Delete :${key}" "$plist" 2>/dev/null || true
|
||||
/usr/libexec/PlistBuddy -c "Add :${key} array" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:0 string UIInterfaceOrientationPortrait" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:1 string UIInterfaceOrientationLandscapeLeft" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :${key}:2 string UIInterfaceOrientationLandscapeRight" "$plist"
|
||||
done
|
||||
/usr/libexec/PlistBuddy -c "Delete :NSAppTransportSecurity" "$plist" 2>/dev/null || true
|
||||
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity dict" "$plist"
|
||||
/usr/libexec/PlistBuddy -c "Add :NSAppTransportSecurity:NSAllowsArbitraryLoads bool true" "$plist"
|
||||
done
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
|
||||
- name: 构建 iOS 应用与打包 IPA
|
||||
shell: bash
|
||||
env:
|
||||
APPLE_DEVELOPMENT_TEAM: "ABCDE12345"
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
mkdir -p artifacts
|
||||
|
||||
# 1. 确保前端编译产物就绪
|
||||
pnpm build
|
||||
|
||||
# 2. 执行 Tauri iOS 自动化构建(免证书签名,激活 custom-protocol 确保为生产打包模式)
|
||||
echo "=== 执行 Tauri iOS 构建 (--no-sign --features custom-protocol) ==="
|
||||
pnpm tauri ios build --no-sign --ci --features custom-protocol || true
|
||||
|
||||
# 3. 检查是否已直接生成 IPA
|
||||
IPA_PATH=$(find src-tauri/gen/apple -name "*.ipa" 2>/dev/null | head -n 1 || true)
|
||||
if [ -n "$IPA_PATH" ] && [ -f "$IPA_PATH" ]; then
|
||||
echo "=== 发现生成的 IPA: $IPA_PATH ==="
|
||||
cp "$IPA_PATH" "artifacts/HGhub_${V}_ios.ipa"
|
||||
fi
|
||||
|
||||
# 4. 若未直接生成 IPA,寻找 .app 或通过 xcodebuild 归档编译
|
||||
if [ ! -s "artifacts/HGhub_${V}_ios.ipa" ]; then
|
||||
APP_PATH=$(find src-tauri/gen/apple -name "*.app" -type d 2>/dev/null | head -n 1 || true)
|
||||
if [ -z "$APP_PATH" ]; then
|
||||
echo "=== 未在 gen/apple 找到 .app,调用 xcodebuild 编译 Release ==="
|
||||
PROJECT_PATH=$(find src-tauri/gen/apple -name "*.xcodeproj" 2>/dev/null | head -n 1 || true)
|
||||
SCHEME_NAME=$(xcodebuild -list -project "$PROJECT_PATH" 2>/dev/null | awk '/Schemes:/{flag=1;next} flag && NF{print $1;exit}' || true)
|
||||
if [ -z "$SCHEME_NAME" ]; then
|
||||
SCHEME_NAME="huangguo-client_iOS"
|
||||
fi
|
||||
echo "项目: $PROJECT_PATH, Scheme: $SCHEME_NAME"
|
||||
xcodebuild build \
|
||||
-project "$PROJECT_PATH" \
|
||||
-scheme "$SCHEME_NAME" \
|
||||
-configuration Release \
|
||||
-destination "generic/platform=iOS" \
|
||||
CODE_SIGNING_ALLOWED=NO \
|
||||
CODE_SIGNING_REQUIRED=NO \
|
||||
CODE_SIGN_IDENTITY="" \
|
||||
-derivedDataPath build_output
|
||||
APP_PATH=$(find build_output -name "*.app" -type d 2>/dev/null | head -n 1 || true)
|
||||
fi
|
||||
|
||||
if [ -n "$APP_PATH" ] && [ -d "$APP_PATH" ]; then
|
||||
echo "=== 打包 APP 目录: $APP_PATH 为 IPA ==="
|
||||
rm -rf Payload
|
||||
mkdir -p Payload
|
||||
cp -r "$APP_PATH" Payload/
|
||||
zip -qr "artifacts/HGhub_${V}_ios.ipa" Payload
|
||||
rm -rf Payload
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -s "artifacts/HGhub_${V}_ios.ipa" ]; then
|
||||
echo "=== IPA 打包成功 ==="
|
||||
ls -lh artifacts/
|
||||
|
||||
# 5. 校验 IPA 是否为真正的生产包(验证不含 localhost:1420 且静态资源嵌入)
|
||||
echo "=== 校验生产包模式 ==="
|
||||
mkdir -p /tmp/verify_ipa
|
||||
unzip -q -o "artifacts/HGhub_${V}_ios.ipa" -d /tmp/verify_ipa
|
||||
BIN_PATH=$(find /tmp/verify_ipa -type f -name "HGhub" | head -n 1 || true)
|
||||
if [ -n "$BIN_PATH" ]; then
|
||||
if strings "$BIN_PATH" | grep -q "localhost:1420"; then
|
||||
echo "::error::警告:构建产物依然包含 localhost:1420,处于 dev 模式!"
|
||||
exit 1
|
||||
fi
|
||||
echo "=== 生产模式校验通过:未包含 devUrl,静态前端资源已内置 ==="
|
||||
fi
|
||||
rm -rf /tmp/verify_ipa
|
||||
else
|
||||
echo "::error::未能生成有效的 iOS IPA 文件"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 上传 IPA 产物
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: HGhub-iOS-IPA
|
||||
path: artifacts/*
|
||||
if-no-files-found: error
|
||||
|
||||
- name: 发布 iOS GitHub Release
|
||||
shell: bash
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
TAG="v${V}-ios"
|
||||
NOTES="## HGhub iOS 增强版 (v${V})
|
||||
|
||||
### ✨ 核心特性
|
||||
- **沉浸式竖屏刷剧流**:支持首页无限推荐流、题材分类、三大榜单(热门/推荐/潜力)、搜索、吃瓜社区图文与视频帖、选集与历史续播。
|
||||
- **原生横竖屏智能切换**:横屏视频支持一键「横屏全屏」(调用 iOS 原生屏幕方向旋转),支持手机物理横置自动全屏、竖回自动退出,独立固定舞台层渲染不跑偏、不闪封面。
|
||||
- **丰富触控手势**:
|
||||
- **双指自由缩放(1x~4x)与平移**:竖屏观看横屏视频可自由缩放,并提供「放大铺满 / 完整适应 / 还原缩放」胶囊按钮;
|
||||
- **单击清屏 / 双击暂停**:单击屏幕隐藏所有控件与遮罩纯享画面,双击屏幕暂停/播放;
|
||||
- **长按 2.0x 倍速 + 上滑锁定**:长按画面开启 2.0x 倍速,上滑即可锁定倍速;
|
||||
- **左右横滑预览定位**:任意位置横滑精准跳转进度。
|
||||
- **HLS 播放稳定性加固**:内置 AES Key 与分片内存缓存、拖动进度条防卡死自愈重连、全屏旋转过渡期持续保活与片尾自动连播下一集。
|
||||
- **多线路与镜像测速**:内置固定主备线路 + 自动抓取最新镜像域名 + 一键延迟测速切换。
|
||||
|
||||
### 📲 安装说明(免证书生产包 \`.ipa\`)
|
||||
1. **TrollStore(巨魔商店)**:下载 \`HGhub_${V}_ios.ipa\` 后直接导入巨魔永久安装。
|
||||
2. **AltStore / SideStore / Sideloadly**:使用个人 Apple ID 自签安装。
|
||||
3. **轻松签(ESign)/ 牛蛙助手 / Feather / 全能签**:导入证书签名后直接安装。"
|
||||
|
||||
if gh release view "$TAG" >/dev/null 2>&1; then
|
||||
gh release upload "$TAG" artifacts/*.ipa --clobber
|
||||
gh release edit "$TAG" --title "HGhub v${V} iOS 正式版" --notes "$NOTES" --prerelease=false --latest
|
||||
else
|
||||
gh release create "$TAG" artifacts/*.ipa \
|
||||
--title "HGhub v${V} iOS 正式版" \
|
||||
--notes "$NOTES" \
|
||||
--latest
|
||||
fi
|
||||
@@ -0,0 +1,147 @@
|
||||
name: Build macOS Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ["main"]
|
||||
|
||||
jobs:
|
||||
macos:
|
||||
name: macOS (${{ matrix.name }})
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: aarch64-apple-darwin
|
||||
name: Apple Silicon (arm64)
|
||||
arch: arm64
|
||||
- target: x86_64-apple-darwin
|
||||
name: Intel (x64)
|
||||
arch: x64
|
||||
- target: universal-apple-darwin
|
||||
name: Universal (通用版)
|
||||
arch: universal
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 对齐版本号
|
||||
id: ver
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
|
||||
V="${GITHUB_REF_NAME#v}"
|
||||
else
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
fi
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
node -e "const fs=require('fs');for(const p of ['src-tauri/tauri.conf.json','package.json']){const j=JSON.parse(fs.readFileSync(p));j.version=process.argv[1];fs.writeFileSync(p,JSON.stringify(j,null,2)+'\n')}" "$V"
|
||||
|
||||
- uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 22
|
||||
cache: pnpm
|
||||
|
||||
- uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: aarch64-apple-darwin,x86_64-apple-darwin
|
||||
|
||||
- uses: swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: src-tauri -> target
|
||||
key: macos-${{ matrix.target }}
|
||||
|
||||
- name: 安装前端依赖
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
- name: 构建 macOS 应用 (DMG + APP)
|
||||
run: |
|
||||
pnpm tauri build --config src-tauri/tauri.macos.conf.json --target ${{ matrix.target }}
|
||||
|
||||
- name: 整理构建产物
|
||||
shell: bash
|
||||
run: |
|
||||
V="${{ steps.ver.outputs.version }}"
|
||||
mkdir -p artifacts
|
||||
|
||||
# 收集 dmg 安装包
|
||||
found_dmg=0
|
||||
for f in $(find src-tauri/target -name '*.dmg'); do
|
||||
echo "发现 DMG: $f"
|
||||
cp "$f" "artifacts/HGhub_${V}_${{ matrix.arch }}.dmg"
|
||||
found_dmg=1
|
||||
done
|
||||
|
||||
# 打包 .app 绿色压缩包(便于不需要 DMG 安装的用户直接拖拽)
|
||||
for app in $(find src-tauri/target -name 'HGhub.app' -type d); do
|
||||
echo "发现 APP: $app"
|
||||
tar -czf "artifacts/HGhub_${V}_${{ matrix.arch }}.app.tar.gz" -C "$(dirname "$app")" "HGhub.app"
|
||||
done
|
||||
|
||||
ls -lh artifacts/
|
||||
if [ "$found_dmg" -eq 0 ]; then
|
||||
echo "::error::未找到 DMG 构建产物"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: 上传构建产物
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: HGhub-macOS-${{ matrix.arch }}
|
||||
path: artifacts/*
|
||||
if-no-files-found: error
|
||||
|
||||
publish-release:
|
||||
name: 发布 GitHub Release
|
||||
needs: [macos]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: 下载所有 macOS 产物
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts
|
||||
merge-multiple: true
|
||||
|
||||
- name: 查看产物列表
|
||||
run: ls -lh artifacts
|
||||
|
||||
- name: 获取版本号
|
||||
id: ver
|
||||
run: |
|
||||
V="$(node -p "require('./src-tauri/tauri.conf.json').version")"
|
||||
echo "version=$V" >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: 发布 Release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: v${{ steps.ver.outputs.version }}-macos
|
||||
name: HGhub v${{ steps.ver.outputs.version }} macOS 专属版
|
||||
body: |
|
||||
## HGhub macOS 编译发布版 (v${{ steps.ver.outputs.version }})
|
||||
|
||||
本项目为 [Minireel/HGhub](https://github.com/Minireel/HGhub) 官方源码针对 macOS 平台的编译产物。
|
||||
原项目已在 PR #1 完成 macOS 适配支持,但官方尚未在 Release 页面发布 Mac 版产物。
|
||||
|
||||
### 下载说明
|
||||
- **Apple Silicon (M1/M2/M3/M4 系列芯片)**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_arm64.dmg`
|
||||
- **Intel 芯片**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_x64.dmg`
|
||||
- **通用双架构版 (全机型支持)**: 推荐下载 `HGhub_${{ steps.ver.outputs.version }}_universal.dmg`
|
||||
|
||||
### macOS 首次打开说明(绕过未签名提示)
|
||||
由于开源个人构建未购买苹果开发者企业证书签名与公证,首次打开若提示“已损坏”或“无法打开”,请在「终端」中执行以下命令清除隔离属性:
|
||||
```bash
|
||||
sudo xattr -rd com.apple.quarantine /Applications/HGhub.app
|
||||
```
|
||||
files: artifacts/*
|
||||
fail_on_unmatched_files: true
|
||||
draft: false
|
||||
prerelease: false
|
||||
@@ -3,6 +3,8 @@
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover, user-scalable=no" />
|
||||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
|
||||
<meta name="theme-color" content="#1a1a1a" />
|
||||
<title>HGhub · 黄果短剧</title>
|
||||
<script>
|
||||
|
||||
@@ -11,6 +11,10 @@ rust-version = "1.90"
|
||||
name = "huangguo_client_lib"
|
||||
crate-type = ["staticlib", "cdylib", "rlib"]
|
||||
|
||||
[features]
|
||||
default = ["custom-protocol"]
|
||||
custom-protocol = ["tauri/custom-protocol"]
|
||||
|
||||
[build-dependencies]
|
||||
tauri-build = { version = "2", features = [] }
|
||||
|
||||
|
||||
@@ -43,6 +43,9 @@
|
||||
],
|
||||
"android": {
|
||||
"minSdkVersion": 24
|
||||
},
|
||||
"iOS": {
|
||||
"developmentTeam": "ABCDE12345"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"build": {
|
||||
"devUrl": null
|
||||
},
|
||||
"bundle": {
|
||||
"iOS": {
|
||||
"minimumSystemVersion": "15.0"
|
||||
|
||||
Reference in New Issue
Block a user