From d19ca5a5877e671f952131c1ddeaeed0e0437d55 Mon Sep 17 00:00:00 2001 From: Yu-Hsuan Date: Sun, 10 Dec 2023 21:33:18 +0100 Subject: [PATCH] ios build attempt #3 --- .github/workflows/mobile.yml | 41 +++++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/.github/workflows/mobile.yml b/.github/workflows/mobile.yml index 54b2e87..e8876b1 100644 --- a/.github/workflows/mobile.yml +++ b/.github/workflows/mobile.yml @@ -51,15 +51,40 @@ jobs: run: | flutter pub get - - name: Prepare iOS provisioning - working-directory: ./.github/secrets + # - name: Prepare iOS provisioning + # working-directory: ./.github/secrets + # run: | + # security create-keychain -p "" build.keychain >/dev/null 2>&1 + # security import WLANThermo_Distribution_Certificate.p12 -t agg -k ~/Library/Keychains/build.keychain -P "" -A >/dev/null 2>&1 + # security list-keychains -s ~/Library/Keychains/build.keychain >/dev/null 2>&1 + # security default-keychain -s ~/Library/Keychains/build.keychain >/dev/null 2>&1 + # security unlock-keychain -p "" ~/Library/Keychains/build.keychain >/dev/null 2>&1 + # security set-key-partition-list -S apple-tool:,apple: -s -k "" ~/Library/Keychains/build.keychain >/dev/null 2>&1 + # Install the Apple certificate and provisioning profile + + - name: Install the Apple certificate and provisioning profile + env: + BUILD_CERTIFICATE_BASE64: ${{ secrets.APPSTORE_CERT_BASE64 }} + BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.MOBILEPROVISION_BASE64 }} + KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} run: | - security create-keychain -p "" build.keychain >/dev/null 2>&1 - security import WLANThermo_Distribution_Certificate.p12 -t agg -k ~/Library/Keychains/build.keychain -P "" -A >/dev/null 2>&1 - security list-keychains -s ~/Library/Keychains/build.keychain >/dev/null 2>&1 - security default-keychain -s ~/Library/Keychains/build.keychain >/dev/null 2>&1 - security unlock-keychain -p "" ~/Library/Keychains/build.keychain >/dev/null 2>&1 - security set-key-partition-list -S apple-tool:,apple: -s -k "" ~/Library/Keychains/build.keychain >/dev/null 2>&1 + # create variables + CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 + PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision + KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db + # import certificate and provisioning profile from secrets + echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH + echo -n "$BUILD_PROVISION_PROFILE_BASE64" | base64 --decode --output $PP_PATH + # create temporary keychain + security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + security set-keychain-settings -lut 21600 $KEYCHAIN_PATH + security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH + # import certificate to keychain + security import $CERTIFICATE_PATH -A -t cert -f pkcs12 -k $KEYCHAIN_PATH + security list-keychain -d user -s $KEYCHAIN_PATH + # apply provisioning profile + mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles + cp $PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles - name: Build iOS app working-directory: ./mobile_flutter/wlanthermo_flutter_app