From cff445d2b0972e296e9a2faf1d162fb44b787474 Mon Sep 17 00:00:00 2001 From: "David R. Myers" Date: Sun, 9 Feb 2025 19:00:36 -0500 Subject: [PATCH] wip: Attempt mobile builds --- .github/workflows/deploy-tauri.yml | 129 ++++++++++++++---- .../gen/apple/app.xcodeproj/project.pbxproj | 2 + src-tauri/gen/apple/app_iOS/Info.plist | 4 +- src-tauri/tauri.conf.json | 2 +- 4 files changed, 107 insertions(+), 30 deletions(-) diff --git a/.github/workflows/deploy-tauri.yml b/.github/workflows/deploy-tauri.yml index 67fd9b47..38065f87 100644 --- a/.github/workflows/deploy-tauri.yml +++ b/.github/workflows/deploy-tauri.yml @@ -7,6 +7,7 @@ on: # This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release. env: + APPLE_DEVELOPMENT_TEAM: ${{ secrets.APPLE_TEAM_ID }} APPLE_ID: ${{ secrets.APPLE_ID }} APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} @@ -47,14 +48,36 @@ jobs: fail-fast: false matrix: include: - - platform: macos-latest # for Arm based macs (M1 and above). - args: --target aarch64-apple-darwin - - platform: macos-latest # for Intel based macs. - args: --target x86_64-apple-darwin - - platform: ubuntu-22.04 # for Tauri v1 you could replace this with ubuntu-20.04. - args: '' - - platform: windows-latest - args: '' + - name: desktop_macos_arm + platform: macos-latest # for Arm based macs (M1 and above). + args: --verbose --target aarch64-apple-darwin + rust_targets: aarch64-apple-darwin,x86_64-apple-darwin + + - name: desktop_macos_intel + platform: macos-latest # for Intel based macs. + args: --verbose --target x86_64-apple-darwin + rust_targets: aarch64-apple-darwin,x86_64-apple-darwin + + - name: mobile_ios + platform: macos-latest # for Intel based macs. + args: --verbose --target x86_64-apple-darwin + rust_targets: aarch64-apple-ios,x86_64-apple-ios,aarch64-apple-ios-sim + ios: true + + - name: desktop_linux + platform: ubuntu-22.04 # for Tauri v1 you could replace this with ubuntu-20.04. + args: --verbose + + - name: mobile_android + platform: ubuntu-latest # for Tauri v1 you could replace this with ubuntu-20.04. + args: --verbose + rust_targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android + android: true + + # Not working yet. + # - name: Desktop Windows + # platform: windows-latest + # args: --verbose runs-on: ${{ matrix.platform }} steps: @@ -68,15 +91,39 @@ jobs: - name: install Rust stable uses: dtolnay/rust-toolchain@stable with: - # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. - targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + targets: ${{ matrix.rust_targets }} - name: install dependencies (ubuntu only) - if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. + if: matrix.platform == 'ubuntu-22.04' || matrix.platform == 'ubuntu-latest' # This must match the platform value defined above. run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + - name: Install xcode + uses: maxim-lobanov/setup-xcode@v1 + if: matrix.ios + with: + xcode-version: latest-stable + + - name: Install Java + if: matrix.android + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + + - name: Setup Android SDK + if: matrix.android + uses: android-actions/setup-android@v3 + + - name: Setup Android NDK + if: matrix.android + uses: nttld/setup-ndk@v1 + id: setup-ndk + with: + ndk-version: r26d + link-to-sdk: true + - name: Install pnpm uses: pnpm/action-setup@v4 with: @@ -98,7 +145,20 @@ jobs: - name: Install dependencies run: pnpm install --shamefully-hoist + - name: init android + if: matrix.android + env: + NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + pnpm tauri android init + + - name: init ios + if: matrix.ios + run: | + pnpm tauri ios init + - name: Import Apple Developer Certificate + if: matrix.platform == 'macos-latest' env: APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} @@ -111,30 +171,45 @@ jobs: security import certificate.p12 -k build.keychain -P "$APPLE_CERTIFICATE_PASSWORD" -T /usr/bin/codesign security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" build.keychain security find-identity -v -p codesigning build.keychain + - name: Verify Certificate + if: matrix.platform == 'macos-latest' run: | set -x CERT_INFO=$(security find-identity -v -p codesigning build.keychain | grep "Developer ID Application") CERT_ID=$(echo "$CERT_INFO" | awk -F'"' '{print $2}') echo "CERT_ID=$CERT_ID" >> $GITHUB_ENV echo "Certificate imported." + - name: Tauri info run: | pnpm tauri info - - uses: tauri-apps/tauri-action@v0 + + - name: Build iOS app + if: matrix.ios + run: | + pnpm tauri ios build --verbose + + - name: Build Android app + if: matrix.android env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} - APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} - APPLE_ID: ${{ secrets.APPLE_ID }} - APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} - APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} - APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} - with: - tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. - releaseName: App v__VERSION__ - releaseBody: See the assets to download this version and install. - releaseDraft: true - prerelease: false - args: ${{ matrix.args }} + NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} + run: | + pnpm tauri android build --verbose + # - uses: tauri-apps/tauri-action@v0 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + # APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + # APPLE_ID: ${{ secrets.APPLE_ID }} + # APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + # APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + # APPLE_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }} + # APPLE_SIGNING_IDENTITY: ${{ env.CERT_ID }} + # with: + # tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version. + # releaseName: App v__VERSION__ + # releaseBody: See the assets to download this version and install. + # releaseDraft: true + # prerelease: false + # args: ${{ matrix.args }} diff --git a/src-tauri/gen/apple/app.xcodeproj/project.pbxproj b/src-tauri/gen/apple/app.xcodeproj/project.pbxproj index 4e31419d..5277680a 100644 --- a/src-tauri/gen/apple/app.xcodeproj/project.pbxproj +++ b/src-tauri/gen/apple/app.xcodeproj/project.pbxproj @@ -280,6 +280,7 @@ SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "arm64 arm64-sim"; + DEVELOPMENT_TEAM = "BL2RJ5DCNK"; }; name = release; }; @@ -370,6 +371,7 @@ SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALID_ARCHS = "arm64 arm64-sim"; + DEVELOPMENT_TEAM = "BL2RJ5DCNK"; }; name = debug; }; diff --git a/src-tauri/gen/apple/app_iOS/Info.plist b/src-tauri/gen/apple/app_iOS/Info.plist index e0b13353..f65912fb 100644 --- a/src-tauri/gen/apple/app_iOS/Info.plist +++ b/src-tauri/gen/apple/app_iOS/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.1.0 + 0.1.2 CFBundleVersion - 0.1.0 + 0.1.2 LSRequiresIPhoneOS UILaunchStoryboardName diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index d1d36cf1..f6f79ec5 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "../node_modules/@tauri-apps/cli/config.schema.json", "productName": "octo", - "version": "0.1.1", + "version": "0.1.2", "identifier": "app.octo", "build": { "frontendDist": "../dist",