Distribute TestFlight Production Build #2
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@01ce38bf961b4e243a6342cbade0dbc8ba3f0432 # 0.12.0 | |
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 swiftgen | |
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@3cf7f8cc28d1b4e7d01e3783be10a97d55d483c8 # v2.7.1 | |
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 |