Skip to content

Commit

Permalink
add testflight gha
Browse files Browse the repository at this point in the history
  • Loading branch information
jowparks committed Mar 25, 2024
1 parent 62d96c4 commit f7e2b0f
Show file tree
Hide file tree
Showing 3 changed files with 109 additions and 38 deletions.
41 changes: 3 additions & 38 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,6 @@ on:
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 20

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install dependencies
run: |
npm install
- name: Get rust ready
run: |
rustup target install x86_64-linux-android
rustup target install armv7-linux-androideabi
rustup target install aarch64-linux-android
rustup target install i686-linux-android
rustup target install x86_64-apple-ios
rustup target install aarch64-apple-ios
cargo build
- name: Build ironfish-native-module
run: |
npx nx cargo-ios ironfish-native-module -- --target='ios'
npx nx cargo-android ironfish-native-module
- name: Verify prebuild success
run: |
npx nx prebuild mobile-app
uses: ./.github/workflows/build_template.yaml
with:
os: macos-latest
46 changes: 46 additions & 0 deletions .github/workflows/build_template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Reusable build

on:
workflow_call:

jobs:
build:
runs-on: ${{ inputs.os }}
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install dependencies
run: |
npm install
- name: Get rust ready
run: |
rustup target install x86_64-linux-android
rustup target install armv7-linux-androideabi
rustup target install aarch64-linux-android
rustup target install i686-linux-android
rustup target install x86_64-apple-ios
rustup target install aarch64-apple-ios
cargo build
- name: Build ironfish-native-module
run: |
npx nx cargo-ios ironfish-native-module -- --target='ios'
npx nx cargo-android ironfish-native-module
- name: Verify prebuild success
run: |
npx nx prebuild mobile-app
60 changes: 60 additions & 0 deletions .github/workflows/testflight.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Testflight Publish
on:
push:


jobs:
publish_testflight:
uses: ./.github/workflows/build_template.yaml
with:
os: macos-latest
steps:
- name: setup codesigning
env:
APPLE_IFLABS_SIGNING_CERT: ${{ secrets.APPLE_IFLABS_SIGNING_CERT }}
APPLE_IFLABS_SIGNING_CERT_PASSWORD: ${{ secrets.APPLE_IFLABS_SIGNING_CERT_PASSWORD }}
APPLE_PROVISIONING_PROFILE: ${{ secrets.APPLE_PROVISIONING_PROFILE }}
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }}
run: |
# create variables
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
PP_PATH=$RUNNER_TEMP/build_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
API_KEY_PATH=$RUNNER_TEMP/api_key.p8
# import certificate and provisioning profile from secrets
echo -n "$APPLE_IFLABS_SIGNING_CERT" | base64 --decode -o $CERTIFICATE_PATH
echo -n "$APPLE_PROVISIONING_PROFILE" | base64 --decode -o $PP_PATH
echo -n "$APPLE_API_KEY" | base64 --decode -o $API_KEY_PATH
# create temporary keychain
security create-keychain -p "$APPLE_IFLABS_SIGNING_CERT_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$APPLE_IFLABS_SIGNING_CERT_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $CERTIFICATE_PATH -P "$APPLE_IFLABS_SIGNING_CERT_PASSWORD" -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
ls $RUNNER_TEMP
- name: publish
working-directory: packages/mobile-app/ios
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APPLE_API_ISSUER: ${{ secrets.APPLE_API_ISSUER }}
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
run: |
echo "Building app..."
ARCHIVE_PATH="$HOME/Library/Developer/Xcode/Archives/mobileapp/$(date +%Y%m%d%H%M%S)/mobileapp.xcarchive"
EXPORT_PATH="$HOME/Library/Developer/Xcode/Archives/mobileapp/$(date +%Y%m%d%H%M%S)/"
xcodebuild -workspace mobileapp.xcworkspace -scheme "mobileapp" clean archive -sdk iphoneos -archivePath $ARCHIVE_PATH -allowProvisioningUpdates
xcodebuild -exportArchive -archivePath $ARCHIVE_PATH -exportPath $EXPORT_PATH -allowProvisioningUpdates
echo "Collecting artifacts.."
cp -R "${ARCHIVE_PATH}/dSYMs" .
IPA="${EXPORT_PATH}mobileapp.ipa"
echo $IPA
echo "Uploading app to iTC..."
xcrun altool --upload-app -t ios -f $IPA --apiKey $API_KEY --apiIssuer $API_ISSUER

0 comments on commit f7e2b0f

Please sign in to comment.