Skip to content

Publish (iOS)

Publish (iOS) #39

Workflow file for this run

name: Publish (iOS)
on:
# Allow manual builds of this workflow
workflow_dispatch: {}
# Run the workflow whenever a new tag named 'v*' is pushed
push:
branches:
- "!*"
tags:
- "v*"
jobs:
build_and_publish:
runs-on: macos-14 # Current beta runner (M1), should be faster
permissions:
actions: write
env:
# Point the `ruby/setup-ruby` action at this Gemfile, so it
# caches dependencies for us.
BUNDLE_GEMFILE: ${{ github.workspace }}/ios/Gemfile
# Point all Cocoapods operations to a custom subdirectory
CP_HOME_RELATIVE: build/cocoapods
CP_HOME_DIR: ${{ github.workspace }}/build/cocoapods
steps:
- name: Check out from git
uses: actions/checkout@v4
## Caching of outputs & dependencies
- uses: actions/cache@v3
name: Pods cache
with:
path: |
.pods-cache
key: ios-pods-${{ hashFiles('ios/Podfile.lock') }}-v2
restore-keys: |
ios-pods-
# Manually extract the derived data using tar so we can preserve permissions & extended file flags, which Xcode
# relies on
- name: Extract data from cache
run: |
if [ -f .pods-cache/cache.tar ]; then tar xvPpf .pods-cache/cache.tar; else echo "No pods cache file"; fi
# Attempt to fetch the Xcode build info from cache
- uses: irgaly/xcode-cache@v1
with:
key: xcode-cache-deriveddata-${{ github.workflow }}-${{ github.sha }}
restore-keys: xcode-cache-deriveddata-${{ github.workflow }}-
delete-used-deriveddata-cache: true
## Set up tools
# Configure ruby according to our .ruby-version
- name: Setup ruby & Bundler
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
# Set up flutter (feel free to adjust the version below)
- name: Setup flutter
uses: subosito/flutter-action@v2
with:
cache: true
flutter-version: 3.16.9
- name: Configure flutter
run: flutter config --no-cli-animations --disable-analytics
- name: Configure xcbuild
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
# Start an ssh-agent that will provide the SSH key from the
# SSH_PRIVATE_KEY secret to `fastlane match`
- name: Setup SSH key
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add - <<< "${{ secrets.SSH_PRIVATE_KEY }}"
## Build project
- name: Download dependencies
run: flutter pub get --offline --enforce-lockfile || flutter pub get --enforce-lockfile
- name: Build & Publish to TestFlight with Fastlane
env:
APP_STORE_CONNECT_API_KEY_KEY: ${{ secrets.APP_STORE_CONNECT_API_KEY_KEY }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: cd ios && bundle exec fastlane beta "build_name:${{ github.ref_name }}"
## Prepare cache data
# Package up the Cocoapods cache for the caching action, including permissions and fine grained timestamps
- name: Package Cocoapods for cache
run: |
mkdir -p .pods-cache "$CP_HOME_RELATIVE" ios/Pods
find build/ios
tar cfPp .pods-cache/cache.tar --format posix "$CP_HOME_RELATIVE" ios/Pods build/ios/pod_inputs.fingerprint