Skip to content
Open

Main #192

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7b039b9
Add ARM64 support and GitHub Actions workflows
kevin197011 Dec 24, 2025
7c6fa12
Fix CocoaPods action reference in GitHub Actions workflows
kevin197011 Dec 24, 2025
37ea294
Remove npm cache from workflow - not needed for appdmg installation
kevin197011 Dec 24, 2025
79a661f
Consolidate workflows: keep single unified workflow
kevin197011 Dec 24, 2025
e1a12d5
Fix hdiutil info command in workflow - remove invalid usage
kevin197011 Dec 24, 2025
9340a39
Update DMG filename to use vagrant-manager (lowercase with hyphen)
kevin197011 Dec 24, 2025
c3cfcbe
Remove documentation files (consolidated into workflow README)
kevin197011 Dec 24, 2025
f8d5cac
Add quarantine removal and Gatekeeper bypass instructions
kevin197011 Dec 24, 2025
f64af25
Update README.md: main branch, macOS 11.0+, ARM64 support
kevin197011 Dec 24, 2025
58d60e8
Add Chinese and English language switching support
kevin197011 Dec 24, 2025
1866d4e
Translate README to Chinese
kevin197011 Dec 24, 2025
3560649
Add LanguageManager files to Xcode project
kevin197011 Dec 24, 2025
747b92a
Add Localizable.strings to Xcode project resources
kevin197011 Dec 24, 2025
f4cc70d
Add language selector UI to Preferences window
kevin197011 Dec 24, 2025
6f431f8
Remove LOCALIZATION_GUIDE.md (consolidated into README)
kevin197011 Dec 24, 2025
b8a5a88
Update Podfile.lock: Upgrade Sparkle to 2.8.1
kevin197011 Dec 24, 2025
232dc83
Fix Xcode project UUID reference issue
kevin197011 Dec 24, 2025
f70750e
chore(general): 项目维护
kevin197011 Dec 24, 2025
f86d91d
docs(docs): 更新项目文档
kevin197011 Dec 24, 2025
e0e5125
chore(general): Rakefile
kevin197011 Dec 24, 2025
a0a8668
chore(general): 项目维护
kevin197011 Dec 24, 2025
1f9b82e
chore(general): 项目维护
kevin197011 Dec 24, 2025
d6332d3
chore: 更新版本号到 2.8.8
kevin197011 Dec 24, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 134 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# GitHub Actions Workflows

本项目包含一个 GitHub Actions workflow 用于自动构建和发布 DMG 包。

## Workflow

### `build-universal-dmg.yml` - DMG 构建和发布

支持构建多种架构的 DMG 包:
- **ARM64**(默认)- Apple Silicon Mac
- **Universal** - 同时支持 ARM64 和 x86_64
- **x86_64** - Intel Mac

**触发方式:**
- 推送以 `v` 开头的 tag(默认构建 ARM64)
- 手动触发(可选择构建类型)

## 使用方法

### 自动发布(推荐)

1. **创建并推送 tag:**
```bash
git tag v2.7.2
git push origin v2.7.2
```

2. **Workflow 会自动:**
- 检测到 tag 推送
- 默认构建 ARM64 版本
- 创建 DMG 包
- 发布到 GitHub Releases

### 手动触发

1. 进入 GitHub 仓库的 **Actions** 标签页
2. 选择 **Build and Release DMG** workflow
3. 点击 **Run workflow**
4. 输入版本号(例如:`v2.7.2`)
5. 选择构建类型(arm64/universal/x86_64,默认 arm64)
6. 点击 **Run workflow**

## 构建产物

构建完成后,会在 GitHub Releases 中创建:
- **Release 标题**:`Release v2.7.2 (arm64)` 或 `Release v2.7.2 (universal)` 等
- **DMG 文件**:根据构建类型命名,例如:
- `Vagrant Manager-2.7.2-arm64.dmg`(ARM64)
- `Vagrant Manager-2.7.2-universal.dmg`(Universal)
- `Vagrant Manager-2.7.2-x86_64.dmg`(Intel)

## 系统要求

构建环境:
- macOS 14 (Sonoma)
- Xcode(通过 GitHub Actions 自动安装)
- Node.js 20(用于 appdmg)
- CocoaPods(自动安装)

## 注意事项

1. **代码签名**:当前 workflow 使用 `CODE_SIGNING_REQUIRED=NO`,如果需要代码签名,需要:
- 配置代码签名证书
- 更新 workflow 中的签名设置

2. **发布权限**:确保 GitHub token 有创建 Release 的权限(默认的 `GITHUB_TOKEN` 通常已足够)

3. **DMG 配置**:DMG 的布局和样式在 `dmg/appdmg.json` 中配置

4. **版本号格式**:建议使用语义化版本号,例如 `v2.7.2`、`v2.8.0` 等

## 故障排除

### 构建失败

1. **检查日志**:在 GitHub Actions 中查看详细的构建日志
2. **验证依赖**:确保 `Podfile` 和 `Podfile.lock` 正确
3. **检查 Xcode 版本**:确保使用的 macOS runner 版本支持所需的 Xcode 版本

### DMG 创建失败

1. **检查 appdmg 配置**:验证 `dmg/appdmg.json` 格式正确
2. **检查资源文件**:确保 `dmg/` 目录中的图片文件存在
3. **验证 .app 文件**:确保 Xcode 构建成功生成了 .app 文件

### 发布失败

1. **检查权限**:确保 GitHub token 有创建 Release 的权限
2. **检查 tag**:确保 tag 格式正确(以 `v` 开头)
3. **检查 Release 是否存在**:如果 Release 已存在,workflow 会失败

## 自定义配置

### 修改构建架构

编辑 workflow 文件中的 `-arch` 参数:
```yaml
-arch arm64 # 仅 ARM64
-arch x86_64 # 仅 Intel
-arch arm64 -arch x86_64 # Universal
```

### 修改 macOS 版本

修改 `runs-on` 字段:
```yaml
runs-on: macos-14 # macOS 14 (Sonoma)
runs-on: macos-13 # macOS 13 (Ventura)
runs-on: macos-12 # macOS 12 (Monterey)
```

### 添加代码签名

如果需要代码签名,需要:
1. 在 GitHub Secrets 中添加证书和密钥
2. 更新 workflow 中的签名步骤

示例:
```yaml
- name: Import Certificate
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.CERTIFICATES_P12 }}
p12-password: ${{ secrets.CERTIFICATES_PASSWORD }}

# 然后在 xcodebuild 命令中移除 CODE_SIGNING_REQUIRED=NO
```

## 相关文件

- `dmg/appdmg.json` - DMG 配置文件
- `Podfile` - CocoaPods 依赖配置
- `.github/workflows/` - Workflow 文件目录

196 changes: 196 additions & 0 deletions .github/workflows/build-universal-dmg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
name: Build and Release DMG

on:
push:
tags:
- 'v*' # 当推送以 v 开头的 tag 时触发,默认构建 ARM64
workflow_dispatch: # 允许手动触发
inputs:
version:
description: 'Version tag (e.g., v2.7.2)'
required: true
type: string
build_type:
description: 'Build type'
required: false
type: choice
options:
- arm64
- universal
- x86_64
default: arm64

jobs:
build-dmg:
name: Build DMG
runs-on: macos-14 # macOS 14 with Apple Silicon support

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install appdmg
run: npm install -g appdmg

- name: Install CocoaPods dependencies
run: |
if ! command -v pod &> /dev/null; then
sudo gem install cocoapods
fi
pod install

- name: Get version from tag
id: get_version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
VERSION="${{ github.event.inputs.version }}"
BUILD_TYPE="${{ github.event.inputs.build_type || 'arm64' }}"
else
VERSION="${GITHUB_REF#refs/tags/}"
BUILD_TYPE="arm64"
fi
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "VERSION_NAME=${VERSION#v}" >> $GITHUB_OUTPUT
echo "BUILD_TYPE=${BUILD_TYPE}" >> $GITHUB_OUTPUT
echo "Building version: ${VERSION} (${BUILD_TYPE})"

- name: Determine architectures
id: archs
run: |
BUILD_TYPE="${{ steps.get_version.outputs.BUILD_TYPE }}"
if [ "${BUILD_TYPE}" == "universal" ]; then
ARCHS="arm64 x86_64"
ARCH_SUFFIX="universal"
elif [ "${BUILD_TYPE}" == "arm64" ]; then
ARCHS="arm64"
ARCH_SUFFIX="arm64"
else
ARCHS="x86_64"
ARCH_SUFFIX="x86_64"
fi
echo "archs=${ARCHS}" >> $GITHUB_OUTPUT
echo "arch_suffix=${ARCH_SUFFIX}" >> $GITHUB_OUTPUT
echo "Building for architectures: ${ARCHS}"

- name: Build Xcode project
run: |
xcodebuild clean -workspace "Vagrant Manager.xcworkspace" \
-scheme "Vagrant Manager" \
-configuration Release

xcodebuild archive -workspace "Vagrant Manager.xcworkspace" \
-scheme "Vagrant Manager" \
-configuration Release \
-arch ${{ steps.archs.outputs.archs }} \
-sdk macosx \
-archivePath "$PWD/build/Vagrant Manager.xcarchive" \
CODE_SIGN_IDENTITY="" \
CODE_SIGNING_REQUIRED=NO \
CODE_SIGNING_ALLOWED=NO

- name: Create export options plist
run: |
cat > exportOptions.plist <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>mac-application</string>
<key>signingStyle</key>
<string>manual</string>
</dict>
</plist>
EOF

- name: Export .app from archive
run: |
xcodebuild -exportArchive \
-archivePath "$PWD/build/Vagrant Manager.xcarchive" \
-exportPath "$PWD/build/export" \
-exportOptionsPlist "$PWD/exportOptions.plist"

- name: Verify architectures
run: |
file "build/export/Vagrant Manager.app/Contents/MacOS/Vagrant Manager"
lipo -info "build/export/Vagrant Manager.app/Contents/MacOS/Vagrant Manager"

- name: Remove quarantine attribute from .app
run: |
xattr -cr "build/export/Vagrant Manager.app"

- name: Copy .app to dmg directory
run: |
cp -R "build/export/Vagrant Manager.app" "dmg/"

- name: Create DMG
working-directory: dmg
run: |
appdmg appdmg.json "../vagrant-manager-${{ steps.get_version.outputs.VERSION_NAME }}-${{ steps.archs.outputs.arch_suffix }}.dmg"

- name: Verify DMG
run: |
hdiutil verify "vagrant-manager-${{ steps.get_version.outputs.VERSION_NAME }}-${{ steps.archs.outputs.arch_suffix }}.dmg"
echo "DMG verification completed successfully"

- name: Get DMG size
id: dmg_size
run: |
DMG_SIZE=$(du -h "vagrant-manager-${{ steps.get_version.outputs.VERSION_NAME }}-${{ steps.archs.outputs.arch_suffix }}.dmg" | cut -f1)
echo "size=${DMG_SIZE}" >> $GITHUB_OUTPUT
echo "DMG size: ${DMG_SIZE}"

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
name: Release ${{ steps.get_version.outputs.VERSION }} (${{ steps.archs.outputs.arch_suffix }})
body: |
## Vagrant Manager ${{ steps.get_version.outputs.VERSION_NAME }} (${{ steps.archs.outputs.arch_suffix }})

### 🍎 Architecture Support
This release is built for **${{ steps.archs.outputs.arch_suffix }}** architecture.
${{ steps.archs.outputs.arch_suffix == 'universal' && 'Supports both Apple Silicon (ARM64) and Intel (x86_64) Macs.' || '' }}
${{ steps.archs.outputs.arch_suffix == 'arm64' && 'Supports Apple Silicon (M1/M2/M3/M4/M5) Macs only.' || '' }}
${{ steps.archs.outputs.arch_suffix == 'x86_64' && 'Supports Intel Macs only.' || '' }}

### 📦 Installation
1. Download the DMG file
2. Open the DMG
3. Drag "Vagrant Manager" to Applications folder

**Note:** If macOS shows "Vagrant Manager is damaged" error:
- Right-click the app and select "Open" (don't double-click)
- Or run: `xattr -cr /Applications/Vagrant\ Manager.app` in Terminal
- Then try opening again

### 📋 Changes
- Built for ${{ steps.archs.outputs.arch_suffix }} architecture
- Requires macOS 11.0 (Big Sur) or later
- Updated Sparkle to 2.x for better ARM64 support

### 🔧 System Requirements
- macOS 11.0 (Big Sur) or later
${{ steps.archs.outputs.arch_suffix == 'universal' && '- Apple Silicon (M1/M2/M3/M4/M5) or Intel Mac' || '' }}
${{ steps.archs.outputs.arch_suffix == 'arm64' && '- Apple Silicon Mac (M1/M2/M3/M4/M5)' || '' }}
${{ steps.archs.outputs.arch_suffix == 'x86_64' && '- Intel Mac' || '' }}
- Vagrant installed and in PATH
- VirtualBox or Parallels installed (if using those providers)

### 📊 Build Info
- **Architecture**: ${{ steps.archs.outputs.arch_suffix }}
- **DMG Size**: ${{ steps.dmg_size.outputs.size }}
- **Build Date**: ${{ github.event.head_commit.timestamp || github.run_started_at }}
draft: false
prerelease: false
files: |
vagrant-manager-${{ steps.get_version.outputs.VERSION_NAME }}-${{ steps.archs.outputs.arch_suffix }}.dmg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

53 changes: 43 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# OS X
.DS_Store

# Xcode
#
build/
*.pbxuser
!default.pbxuser
Expand All @@ -13,16 +11,51 @@ build/
!default.perspectivev3
xcuserdata
*.xccheckout
profile
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
project.xcworkspace

# CocoaPods
Pods
assets/clean.psd
assets/default.psd
assets/flat.psd
assets/indicators.psd
assets/problem.psd
#
Pods/

# App packaging
#
*.dmg
*.app.dSYM.zip
*.app.dSYM

# Build artifacts
#
exportOptions.plist
*.xcarchive

# OS X
#
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

.cursor
Loading