Mini Project, Part 2: The iOS Equivalent
The same release pipeline for the iOS version of the shop app. Everything here needs macOS, Xcode and Apple developer credentials, so it's non-run: the files are complete and follow Apple's and Fastlane's documentation, and the one runnable piece is the requirement map that ties both platforms together.
Requirements, mapped from Android
| # | Android (Part 1) | iOS |
|---|---|---|
| 1 | flavors free / paid |
two schemes on one target with configurations Release-Free / Release-Paid, or two targets |
| 2 | versionName from the tag, versionCode from tag + build number |
MARKETING_VERSION from the tag, CURRENT_PROJECT_VERSION from the CI build number |
| 3 | signing from Gradle properties | signing assets from match (read-only), App Store Connect API key from CI secrets |
| 4 | R8 + keep rules, mapping.txt archived |
Release optimisation (-O, dead-code stripping), .dSYM archived and uploaded |
| 5 | signed APK + AAB | .xcarchive exported to a signed .ipa |
| 6 | ci/verify-release.sh |
ci/verify-ios.sh: codesign, entitlements, Info.plist versions |
| 7 | build cache, configuration cache | SwiftPM checkouts cached on Package.resolved, pinned Xcode |
The project settings
// Configs/Shop.xcconfig (assigned to the Shop target for every configuration)
PRODUCT_BUNDLE_IDENTIFIER = com.example.shop
MARKETING_VERSION = 0.0.0 // overridden by CI from the tag
CURRENT_PROJECT_VERSION = 1 // overridden by CI from the run number
IPHONEOS_DEPLOYMENT_TARGET = 17.0
CODE_SIGN_STYLE = Manual
DEVELOPMENT_TEAM = ABCDE12345
// Configs/Release-Free.xcconfig
#include "Shop.xcconfig"
PRODUCT_BUNDLE_IDENTIFIER = com.example.shop.free
SWIFT_ACTIVE_COMPILATION_CONDITIONS = $(inherited) FREE
PROVISIONING_PROFILE_SPECIFIER = match AppStore com.example.shop.free
CODE_SIGN_IDENTITY = Apple Distribution
DEBUG_INFORMATION_FORMAT = dwarf-with-dsymmatch names the profiles it creates match AppStore <bundle id>, which is why the specifier can be written down in advance.
The Fastfile lane
# fastlane/Fastfile
platform :ios do
lane :release_free do
setup_ci
api_key = app_store_connect_api_key(
key_id: ENV.fetch("ASC_KEY_ID"), issuer_id: ENV.fetch("ASC_ISSUER_ID"), key_content: ENV.fetch("ASC_KEY_P8")
)
match(type: "appstore", readonly: true, app_identifier: ["com.example.shop.free"])
version = sh("git describe --tags --abbrev=0 --match 'v*'").strip.delete_prefix("v")
run_tests(scheme: "Shop-Free", devices: ["iPhone 16"], result_bundle: true)
build_app(
scheme: "Shop-Free",
configuration: "Release-Free",
export_method: "app-store",
output_directory: "build",
xcargs: "MARKETING_VERSION=#{version} CURRENT_PROJECT_VERSION=#{ENV.fetch('BUILD_NUMBER')} " \
"-onlyUsePackageVersionsFromResolvedFile"
)
sh("../ci/verify-ios.sh", lane_context[SharedValues::IPA_OUTPUT_PATH], version, ENV.fetch("BUILD_NUMBER"))
upload_to_testflight(api_key: api_key, skip_waiting_for_build_processing: true)
end
end(sh in a Fastfile runs from the fastlane/ folder, hence ../ci/….)
The verification script
The iOS counterpart of ci/verify-release.sh: unzip the .ipa, then check the signature, the signer, the entitlements and the versions.
#!/bin/bash
# ci/verify-ios.sh IPA EXPECTED_VERSION EXPECTED_BUILD (macOS only)
set -euo pipefail
IPA=$1 VERSION=$2 BUILD=$3
fail() { echo "FAIL: $*"; exit 1; }
WORK=$(mktemp -d) && unzip -q "$IPA" -d "$WORK"
APP=$(ls -d "$WORK"/Payload/*.app)
codesign --verify --deep --strict "$APP" || fail "signature does not verify"
codesign -dvv "$APP" 2>&1 | grep -q '^Authority=Apple Distribution' || fail "not signed for distribution"
plist() { /usr/libexec/PlistBuddy -c "Print :$1" "$APP/Info.plist"; }
[ "$(plist CFBundleShortVersionString)" = "$VERSION" ] || fail "version is $(plist CFBundleShortVersionString)"
[ "$(plist CFBundleVersion)" = "$BUILD" ] || fail "build is $(plist CFBundleVersion)"
codesign -d --entitlements :- "$APP" > ent.plist 2>/dev/null
/usr/libexec/PlistBuddy -c "Print :get-task-allow" ent.plist 2>/dev/null | grep -q false \
|| fail "get-task-allow is not false (debug entitlement)"
echo "OK: $(basename "$IPA") $VERSION ($BUILD)"get-task-allow = true is iOS's application-debuggable: it lets a debugger attach, and App Store builds must not have it.
The workflow
# .github/workflows/release.yml (both platforms from one tag)
on:
push:
tags: ['v*']
jobs:
android:
runs-on: ubuntu-24.04
environment: production
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
# … Part 1: setup-java, setup-gradle, keystore from secret, ./gradlew …, ci/verify-release.sh, fastlane android internal
ios:
runs-on: macos-15
environment: production
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- run: sudo xcode-select -s /Applications/Xcode_16.4.app
- uses: actions/cache@v4
with:
path: build/SourcePackages
key: spm-${{ hashFiles('**/Package.resolved') }}
- uses: ruby/setup-ruby@v1
with: { bundler-cache: true }
- run: bundle exec fastlane ios release_free
env:
BUILD_NUMBER: ${{ github.run_number }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_TOKEN_B64 }}
ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }}
ASC_ISSUER_ID: ${{ secrets.ASC_ISSUER_ID }}
ASC_KEY_P8: ${{ secrets.ASC_KEY_P8 }}
- uses: actions/upload-artifact@v4
with:
name: ios-${{ github.ref_name }}
path: |
build/*.ipa
build/*.dSYM.zipA runnable check: is every requirement covered on both platforms?
Release checklists drift when one platform gets a new rule and the other doesn't. A small table-driven check keeps both pipelines honest; extend it as your rules grow:
requirements = ["two editions", "version from tag", "build number from CI", "no secrets in repo",
"release optimisation", "symbols archived", "signed store artifact",
"artifact verified before upload", "pinned toolchain", "dependency cache"]
android = {
"two editions": "productFlavors free/paid",
"version from tag": "providers.exec git describe -> versionName",
"build number from CI": "-PbuildNumber -> versionCode",
"no secrets in repo": "ORG_GRADLE_PROJECT_* from CI secrets",
"release optimisation": "isMinifyEnabled + isShrinkResources",
"symbols archived": "mapping.txt artifact (+ inside the AAB)",
"signed store artifact": "bundleFreeRelease (.aab)",
"artifact verified before upload": "ci/verify-release.sh",
"pinned toolchain": "wrapper 9.8.2, AGP 9.4.1, ubuntu-24.04",
"dependency cache": "setup-gradle (read-only on PRs)",
}
ios = {
"two editions": "schemes Shop-Free/Shop-Paid",
"version from tag": "MARKETING_VERSION=<tag>",
"build number from CI": "CURRENT_PROJECT_VERSION=$BUILD_NUMBER",
"no secrets in repo": "match (encrypted) + ASC API key secrets",
"release optimisation": "Release config: -O, dead code stripping",
"symbols archived": "dSYM.zip artifact + uploadSymbols",
"signed store artifact": "build_app -> .ipa",
"pinned toolchain": "macos-15 + xcode-select Xcode_16.4",
"dependency cache": "SourcePackages keyed on Package.resolved",
}
for req in requirements:
a, i = android.get(req), ios.get(req)
status = "ok " if a and i else "GAP "
print(f"{status}{req:<32} android: {a or '-'}")
print(f" {'':<32} ios: {i or '-'}")
missing = [r for r in requirements if r not in android or r not in ios]
print("gaps:", missing or "none")ok two editions android: productFlavors free/paid
ios: schemes Shop-Free/Shop-Paid
ok version from tag android: providers.exec git describe -> versionName
ios: MARKETING_VERSION=<tag>
ok build number from CI android: -PbuildNumber -> versionCode
ios: CURRENT_PROJECT_VERSION=$BUILD_NUMBER
ok no secrets in repo android: ORG_GRADLE_PROJECT_* from CI secrets
ios: match (encrypted) + ASC API key secrets
ok release optimisation android: isMinifyEnabled + isShrinkResources
ios: Release config: -O, dead code stripping
ok symbols archived android: mapping.txt artifact (+ inside the AAB)
ios: dSYM.zip artifact + uploadSymbols
ok signed store artifact android: bundleFreeRelease (.aab)
ios: build_app -> .ipa
GAP artifact verified before upload android: ci/verify-release.sh
ios: -
ok pinned toolchain android: wrapper 9.8.2, AGP 9.4.1, ubuntu-24.04
ios: macos-15 + xcode-select Xcode_16.4
ok dependency cache android: setup-gradle (read-only on PRs)
ios: SourcePackages keyed on Package.resolved
gaps: ['artifact verified before upload']
The gap is real: the iOS lane above does run ci/verify-ios.sh, but the table wasn't updated, which is exactly the kind of drift such a check exists to catch. Add "artifact verified before upload": "ci/verify-ios.sh" to ios and run it again to see gaps: none.
Where to go next
- Release Engineering & CI/CD: changelogs, release branches, and promotion across environments for every kind of software.
- Software Supply Chain Security: signing and provenance for the artifacts these pipelines produce.
- Build Performance & Artifacts: artifact repositories and caches at scale.
Test yourself
What is the iOS counterpart of Android's application-debuggable check?
- CFBundleVersion
- The get-task-allow entitlement must be false
- The provisioning profile name
- MARKETING_VERSION
Why can the xcconfig name the profile match AppStore com.example.shop.free before it exists on the machine?
- Xcode guesses it
- match creates profiles with that predictable naming scheme and installs them at the start of the lane
- It's a wildcard
- The name is ignored
Which iOS artifacts must be archived for every release, like mapping.txt on Android?
- Package.swift
- The .dSYM files
- The Matchfile
- The xcconfig files