44 push :
55 branches :
66 - master
7+ - rust-static-2
78 tags :
89 - ' v[0-9]+.[0-9]+.[0-9]+*'
910 paths :
@@ -140,6 +141,20 @@ jobs:
140141 if : matrix.build_type == 'Release'
141142 shell : bash
142143 run : |
144+ thin_macos_tree() {
145+ src_dir="$1"
146+ dst_dir="$2"
147+ arch="$3"
148+
149+ cp -a "$src_dir" "$dst_dir"
150+
151+ while IFS= read -r -d '' f; do
152+ tmp="${f}.thin"
153+ lipo -thin "$arch" "$f" -output "$tmp"
154+ mv "$tmp" "$f"
155+ done < <(find "$dst_dir" -type f \( -path "$dst_dir/bin/*" -o -path "$dst_dir/lib/*.dylib*" -o -path "$dst_dir/lib/*.a" \) -print0)
156+ }
157+
143158 SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
144159
145160 if [[ ${{ matrix.with_tts }} == ON ]]; then
@@ -163,16 +178,54 @@ jobs:
163178
164179 tar cjvf ${dst}.tar.bz2 $dst
165180
181+ lib_dst=${dst}-lib
182+ mkdir -p ${lib_dst}/lib
183+ if [[ ${{ matrix.lib_type }} == shared ]]; then
184+ cp -av build/install/lib/lib*.dylib* ${lib_dst}/lib/
185+ rm -f ${lib_dst}/lib/libcargs.dylib ${lib_dst}/lib/libcargs*.dylib
186+ else
187+ cp -av build/install/lib/lib*.a ${lib_dst}/lib/
188+ rm -f ${lib_dst}/lib/libcargs.a
189+ fi
190+ tree ${lib_dst}
191+ tar cjvf ${lib_dst}.tar.bz2 ${lib_dst}
192+
193+ for arch in x86_64 arm64; do
194+ if [[ "$arch" == "x86_64" ]]; then
195+ arch_name=x64
196+ else
197+ arch_name=arm64
198+ fi
199+
200+ arch_dst=${dst/osx-universal2/osx-${arch_name}}
201+ thin_macos_tree "$dst" "$arch_dst" "$arch"
202+ tree "$arch_dst"
203+ tar cjvf ${arch_dst}.tar.bz2 ${arch_dst}
204+
205+ arch_lib_dst=${lib_dst/osx-universal2/osx-${arch_name}}
206+ thin_macos_tree "$lib_dst" "$arch_lib_dst" "$arch"
207+ tree "$arch_lib_dst"
208+ tar cjvf ${arch_lib_dst}.tar.bz2 ${arch_lib_dst}
209+ done
210+
166211 - name : Release pre-compiled binaries and libs for macOS
167- if : matrix.build_type == 'Release' && ( github.repository_owner == 'csukuangfj' || github.repository_owner == 'k2-fsa') && github.event_name == 'push' && contains(github.ref, 'refs/tags/')
212+ if : github.repository_owner == 'csukuangfj' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
168213 uses : svenstaro/upload-release-action@v2
169214 with :
170215 file_glob : true
171216 overwrite : true
172- file : sherpa-onnx-*osx-universal2*.tar.bz2
173- # repo_name: k2-fsa/sherpa-onnx
174- # repo_token: ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
175- # tag: v1.12.24
217+ file : sherpa-onnx-*.tar.bz2
218+ repo_name : k2-fsa/sherpa-onnx
219+ repo_token : ${{ secrets.UPLOAD_GH_SHERPA_ONNX_TOKEN }}
220+ tag : v1.12.31
221+
222+ - name : Release pre-compiled binaries and libs for macOS
223+ if : github.repository_owner == 'k2-fsa' && github.event_name == 'push' && contains(github.ref, 'refs/tags/') && matrix.build_type == 'Release'
224+ uses : svenstaro/upload-release-action@v2
225+ with :
226+ file_glob : true
227+ overwrite : true
228+ file : sherpa-onnx-*.tar.bz2
176229
177230 - name : Test offline FireRedASR
178231 if : matrix.build_type != 'Debug'
@@ -338,5 +391,3 @@ jobs:
338391 export EXE=decode-file-c-api
339392
340393 .github/scripts/test-online-transducer.sh
341-
342-
0 commit comments