-
Notifications
You must be signed in to change notification settings - Fork 2
199 lines (166 loc) · 7.06 KB
/
release.yml
File metadata and controls
199 lines (166 loc) · 7.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Release
on:
push:
tags:
- '[0-9]*.[0-9]*.[0-9]*'
- '!*-*'
jobs:
release:
runs-on: macos-15
permissions:
contents: write
steps:
- name: Checkout repository (with submodules)
uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0
- name: Select latest Xcode (Swift 6.2+)
run: |
LATEST_XCODE=$(ls -d /Applications/Xcode*.app | sort -V | tail -1)
echo "Selecting $LATEST_XCODE"
sudo xcode-select -s "$LATEST_XCODE"
swift --version
- name: Install dependencies
run: brew install cmake libomp rust
- name: Set up Ruby (for xcpretty)
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
- name: Install xcpretty
run: gem install xcpretty
- name: Build Rust autocorrect dylib
run: |
mkdir -p build
cargo build -p autocorrect-swift --release --target aarch64-apple-darwin \
--manifest-path=asian-autocorrect/Cargo.toml
cp ./asian-autocorrect/target/aarch64-apple-darwin/release/libautocorrect_swift.dylib \
./build/libautocorrect_swift.dylib
install_name_tool -id "@rpath/libautocorrect_swift.dylib" ./build/libautocorrect_swift.dylib
codesign --force --sign - ./build/libautocorrect_swift.dylib
- name: Copy libomp
run: |
cp /opt/homebrew/opt/libomp/lib/libomp.dylib ./build/libomp.dylib
install_name_tool -id "@rpath/libomp.dylib" ./build/libomp.dylib
codesign --force --sign - ./build/libomp.dylib
- name: Build WeTextProcessing ITN processor
run: |
cmake -B WeTextProcessing/build -S WeTextProcessing/runtime \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5
patch -p1 -N -d WeTextProcessing/runtime/fc_base-*/openfst-src \
< patches/WeTextProcessing/001-fix-openfst-bi-table-copy-ctor.patch 2>/dev/null || true
cmake --build WeTextProcessing/build -j8
cp WeTextProcessing/build/bin/processor_main ./build/processor_main
codesign --force --sign - ./build/processor_main
echo "✅ WeTextProcessing build successful"
- name: Resolve SPM packages and apply patches
run: |
chmod +x ./Scripts/resolve_and_patch.sh
./Scripts/resolve_and_patch.sh
- name: Build app (Release)
run: |
xcodebuild -scheme OpenSuperMLX -configuration Release -jobs 8 \
-derivedDataPath build -quiet \
-destination 'platform=macOS,arch=arm64' \
-skipPackagePluginValidation -skipMacroValidation \
-UseModernBuildSystem=YES \
-clonedSourcePackagesDirPath SourcePackages \
-skipUnavailableActions \
CODE_SIGNING_ALLOWED=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO \
build 2>&1 | xcpretty --simple --color
- name: Ad-hoc sign app bundle
run: |
APP_PATH="build/Build/Products/Release/OpenSuperMLX.app"
if [[ ! -d "$APP_PATH" ]]; then
echo "❌ App not found at $APP_PATH"
exit 1
fi
# --deep signs all nested code (dylibs, frameworks, bundles) inside-out.
# Appropriate for ad-hoc signing; avoids the find -type f bug with .framework dirs.
codesign --force --deep --sign - "$APP_PATH"
echo "✅ Ad-hoc signed app bundle"
codesign -vv "$APP_PATH"
- name: Create DMG
run: |
APP_PATH="build/Build/Products/Release/OpenSuperMLX.app"
if [[ ! -d "$APP_PATH" ]]; then
echo "❌ App not found at $APP_PATH"
exit 1
fi
mkdir -p dmg_staging
cp -R "$APP_PATH" dmg_staging/
ln -s /Applications dmg_staging/Applications
hdiutil create -volname "OpenSuperMLX" -srcfolder dmg_staging \
-ov -format UDZO OpenSuperMLX.dmg
shasum -a 256 OpenSuperMLX.dmg > OpenSuperMLX.dmg.sha256
- name: Create GitHub Release
env:
GH_TOKEN: ${{ github.token }}
run: |
VERSION="${GITHUB_REF_NAME}"
SHA256=$(cut -d' ' -f1 OpenSuperMLX.dmg.sha256)
# Find previous stable tag (exclude tags with hyphens: -test, -beta, -rc, etc.)
PREV_TAG=$(git tag --sort=-v:refname | grep -v '-' | grep -v "^${VERSION}$" | head -1)
if [[ -n "$PREV_TAG" ]]; then
CHANGELOG=$(git log "${PREV_TAG}..${VERSION}" --pretty=format:"- %s" --no-merges)
else
CHANGELOG=$(git log "d20968b..${VERSION}" --pretty=format:"- %s" --no-merges)
fi
NOTES=$(cat <<EOF
## What's Changed
${CHANGELOG}
---
### Installation via Homebrew (Recommended)
\`\`\`bash
brew tap axot/tap
brew install --cask opensupermlx
\`\`\`
### Manual Installation
1. Download **OpenSuperMLX.dmg** below
2. Open the DMG and drag OpenSuperMLX to Applications
3. On first launch: right-click the app → **Open** (required for unsigned apps)
4. Grant microphone and accessibility permissions when prompted
### Requirements
- macOS 15.1 or later
- Apple Silicon (M1/M2/M3/M4) Mac
EOF
)
gh release create "$VERSION" \
--title "Release $VERSION" \
--notes "$NOTES" \
OpenSuperMLX.dmg \
OpenSuperMLX.dmg.sha256
- name: Update Homebrew tap
if: ${{ env.HOMEBREW_TAP_TOKEN != '' }}
env:
HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
set -e
VERSION="${GITHUB_REF_NAME}"
SHA256=$(cut -d' ' -f1 OpenSuperMLX.dmg.sha256)
git clone "https://x-access-token:${HOMEBREW_TAP_TOKEN}@github.com/axot/homebrew-tap.git" /tmp/homebrew-tap
mkdir -p /tmp/homebrew-tap/Casks
cat > /tmp/homebrew-tap/Casks/opensupermlx.rb <<CASK
cask "opensupermlx" do
version "${VERSION}"
sha256 "${SHA256}"
url "https://github.com/axot/OpenSuperMLX/releases/download/#{version}/OpenSuperMLX.dmg"
name "OpenSuperMLX"
desc "Real-time audio transcription for macOS powered by MLX on Apple Silicon"
homepage "https://github.com/axot/OpenSuperMLX"
depends_on macos: ">= :sequoia"
depends_on arch: :arm64
app "OpenSuperMLX.app"
zap trash: [
"~/Library/Application Scripts/org.axot.OpenSuperMLX",
"~/Library/Application Support/org.axot.OpenSuperMLX",
"~/Library/Preferences/org.axot.OpenSuperMLX.plist",
]
end
CASK
cd /tmp/homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Casks/opensupermlx.rb
git diff --cached --quiet || git commit -m "Update opensupermlx to ${VERSION}"
git push