From eb6768f1f6607319077be53087859cd1a26a94ce Mon Sep 17 00:00:00 2001 From: Hyoda Kazuaki Date: Sat, 20 May 2023 22:55:09 +0900 Subject: [PATCH] =?UTF-8?q?iOS=E5=90=91=E3=81=91XCFramework=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B=20(#485)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Hiroshiba --- .github/workflows/build_and_deploy.yml | 56 +++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy.yml b/.github/workflows/build_and_deploy.yml index 06573ede9..46a506446 100644 --- a/.github/workflows/build_and_deploy.yml +++ b/.github/workflows/build_and_deploy.yml @@ -186,13 +186,19 @@ jobs: env: CERT_BASE64: ${{ secrets.CERT_BASE64 }} CERT_PASSWORD: ${{ secrets.CERT_PASSWORD }} + - name: Upload artifact to build XCFramework + if: contains(matrix.target, 'ios') + uses: actions/upload-artifact@v2 + with: + name: voicevox_core-${{ matrix.target }} + path: artifact/${{ env.ASSET_NAME }} - name: Archive artifact shell: bash run: | cd artifact 7z a "../${{ env.ASSET_NAME }}.zip" "${{ env.ASSET_NAME }}" - name: Upload to Release - if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' + if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' && !contains(matrix.target, 'ios') uses: softprops/action-gh-release@v1 with: prerelease: true @@ -209,6 +215,54 @@ jobs: files: |- ${{ steps.build-voicevox-core-python-api.outputs.whl }} target_commitish: ${{ github.sha }} + build_xcframework: + needs: build_and_deploy + runs-on: macos-12 + steps: + - name: Set ASSET_NAME env var + shell: bash + run: echo "ASSET_NAME=voicevox_core-ios-xcframework-cpu-${{ env.VERSION }}" >> "$GITHUB_ENV" + - uses: actions/download-artifact@v2 + with: + name: voicevox_core-x86_64-apple-ios + path: artifact/voicevox_core-x86_64-apple-ios + - uses: actions/download-artifact@v2 + with: + name: voicevox_core-aarch64-apple-ios-sim + path: artifact/voicevox_core-aarch64-apple-ios-sim + - uses: actions/download-artifact@v2 + with: + name: voicevox_core-aarch64-apple-ios + path: artifact/voicevox_core-aarch64-apple-ios + - name: Create fat binary + shell: bash + run: | + mkdir -p "artifact/voicevox_core-sim" + lipo -create "artifact/voicevox_core-x86_64-apple-ios/libvoicevox_core.dylib" "artifact/voicevox_core-aarch64-apple-ios-sim/libvoicevox_core.dylib" -output "artifact/voicevox_core-sim/libvoicevox_core.dylib" + - name: Create XCFramework + shell: bash + run: | + mkdir -p "artifact/${{ env.ASSET_NAME }}" + xcodebuild -create-xcframework \ + -library "artifact/voicevox_core-sim/libvoicevox_core.dylib" \ + -headers "artifact/voicevox_core-x86_64-apple-ios/voicevox_core.h" \ + -library "artifact/voicevox_core-aarch64-apple-ios/libvoicevox_core.dylib" \ + -headers "artifact/voicevox_core-aarch64-apple-ios/voicevox_core.h" \ + -output "artifact/${{ env.ASSET_NAME }}/voicevox_core.xcframework" + - name: Archive artifact + shell: bash + run: | + cd artifact/${{ env.ASSET_NAME }} + 7z a "../../${{ env.ASSET_NAME }}.zip" "voicevox_core.xcframework" + - name: Upload to Release + if: env.VERSION != '0.0.0' && env.SKIP_UPLOADING_RELEASE_ASSET == '0' + uses: softprops/action-gh-release@v1 + with: + prerelease: true + tag_name: ${{ env.VERSION }} + files: |- + ${{ env.ASSET_NAME }}.zip + target_commitish: ${{ github.sha }} deploy_downloader: runs-on: ubuntu-latest steps: