Committed by
GitHub
Publish pre-compiled xcframework for iOS via GitHub actions (#203)
正在显示
1 个修改的文件
包含
85 行增加
和
0 行删除
.github/workflows/build-xcframework.yaml
0 → 100644
| 1 | +name: build-xcframework | ||
| 2 | + | ||
| 3 | +on: | ||
| 4 | + push: | ||
| 5 | + branches: | ||
| 6 | + - xcframework | ||
| 7 | + tags: | ||
| 8 | + - '*' | ||
| 9 | + | ||
| 10 | + workflow_dispatch: | ||
| 11 | + | ||
| 12 | +concurrency: | ||
| 13 | + group: build-xcframework-${{ github.ref }} | ||
| 14 | + cancel-in-progress: true | ||
| 15 | + | ||
| 16 | +jobs: | ||
| 17 | + build_xcframework: | ||
| 18 | + name: Build xcframework on ${{ matrix.os }} | ||
| 19 | + runs-on: ${{ matrix.os }} | ||
| 20 | + strategy: | ||
| 21 | + fail-fast: false | ||
| 22 | + matrix: | ||
| 23 | + os: [macos-latest] | ||
| 24 | + | ||
| 25 | + steps: | ||
| 26 | + - uses: actions/checkout@v2 | ||
| 27 | + | ||
| 28 | + - name: Build iOS | ||
| 29 | + shell: bash | ||
| 30 | + run: | | ||
| 31 | + ./build-ios.sh | ||
| 32 | + | ||
| 33 | + - name: Display artifacts | ||
| 34 | + shell: bash | ||
| 35 | + run: | | ||
| 36 | + brew install tree | ||
| 37 | + tree -L 2 ./build-ios | ||
| 38 | + | ||
| 39 | + - name: Package artifacts | ||
| 40 | + shell: bash | ||
| 41 | + run: | | ||
| 42 | + SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2) | ||
| 43 | + echo "SHERPA_ONNX_VERSION=$SHERPA_ONNX_VERSION" >> "$GITHUB_ENV" | ||
| 44 | + | ||
| 45 | + rm -rf build-ios/build | ||
| 46 | + rm -rf build-ios/install | ||
| 47 | + rm -rf build-ios/ios-onnxruntime/.git | ||
| 48 | + | ||
| 49 | + tree build-ios | ||
| 50 | + | ||
| 51 | + filename=sherpa-onnx-${SHERPA_ONNX_VERSION}-pre-compiled-ios-libs.tar.bz2 | ||
| 52 | + | ||
| 53 | + tar cjvf $filename ./build-ios | ||
| 54 | + | ||
| 55 | + ls -lh | ||
| 56 | + | ||
| 57 | + - uses: actions/upload-artifact@v2 | ||
| 58 | + with: | ||
| 59 | + name: sherpa-onnx-pre-compiled-ios-libs | ||
| 60 | + path: ./build-ios | ||
| 61 | + | ||
| 62 | + # https://huggingface.co/docs/hub/spaces-github-actions | ||
| 63 | + - name: Publish to huggingface | ||
| 64 | + if: ${{ github.repository_owner == 'csukuangfj' }} || ${{ github.repository_owner == 'k2-fsa' }} | ||
| 65 | + env: | ||
| 66 | + HF_TOKEN: ${{ secrets.HF_TOKEN }} | ||
| 67 | + run: | | ||
| 68 | + git config --global user.email "csukuangfj@gmail.com" | ||
| 69 | + git config --global user.name "Fangjun Kuang" | ||
| 70 | + | ||
| 71 | + GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/csukuangfj/sherpa-onnx-libs huggingface | ||
| 72 | + | ||
| 73 | + cd huggingface | ||
| 74 | + git lfs pull | ||
| 75 | + | ||
| 76 | + cp -v ../sherpa-onnx-*-pre-compiled-ios-libs.tar.bz2 ./ | ||
| 77 | + | ||
| 78 | + git status | ||
| 79 | + git lfs track "*.bz2" | ||
| 80 | + | ||
| 81 | + git add . | ||
| 82 | + | ||
| 83 | + git commit -m "upload sherpa-onnx-${SHERPA_ONNX_VERSION}-pre-compiled-ios-libs.tar.bz2" | ||
| 84 | + | ||
| 85 | + git push https://csukuangfj:$HF_TOKEN@huggingface.co/csukuangfj/sherpa-onnx-libs main |
-
请 注册 或 登录 后发表评论