Distribute TestFlight Production Build #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Distribute TestFlight Production Build | |
on: | |
workflow_dispatch: | |
jobs: | |
distribute_testflight: | |
if: contains('["krodak","prybalko"]', github.actor) | |
runs-on: macos-13 | |
name: Distribute TestFlight Production Build | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # 0.12.1 | |
with: | |
access_token: ${{ github.token }} | |
- name: Checkout repository | |
uses: actions/[email protected] | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.7' | |
bundler-cache: true | |
- name: Setup - Xcode | |
run: sudo xcode-select -switch '/Applications/Xcode_15.0.app/Contents/Developer' && /usr/bin/xcodebuild -version | |
- name: Install dependencies | |
run: | | |
brew install sourcery | |
- name: Get cached Swift Packages managed by Xcode | |
uses: actions/cache@v3 | |
with: | |
path: ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/ | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
restore-keys: | | |
${{ runner.os }}-spm- | |
- name: Install Rust targets | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: x86_64-apple-ios,aarch64-apple-ios | |
components: rust-std | |
- name: Install uniffi_bindgen | |
uses: actions-rs/[email protected] | |
with: | |
crate: uniffi_bindgen | |
version: 0.22.0 # Must be in sync with version in Cargo.toml | |
use-tool-cache: true | |
- name: Rust Cache | |
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3 | |
with: | |
workspaces: rust -> rust/target | |
- name: Install the Apple certificate and provisioning profile | |
env: | |
IOS_CERT_BASE64: ${{ secrets.IOS_CERT_BASE64 }} | |
IOS_CERT_PASSWORD: ${{ secrets.IOS_CERT_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
# create variables | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
# import certificate and provisioning profile from secrets | |
echo -n "$IOS_CERT_BASE64" | base64 --decode -o $CERTIFICATE_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 -P "$IOS_CERT_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
echo "KEYCHAIN_PATH_ENV=$(echo $KEYCHAIN_PATH)" >> $GITHUB_ENV | |
- name: Distribute TestFlight build | |
env: | |
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} | |
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }} | |
ASC_KEY_BASE64: ${{ secrets.ASC_KEY_BASE64 }} | |
BUILD_NUMBER: $GITHUB_RUN_ID | |
KEYCHAIN_PATH: ${{ env.KEYCHAIN_PATH_ENV }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
cd ios | |
bundle exec fastlane distribute_production_testflight |