Key takeaways
- fastlane suits agent work because every lane can be executed and verified within minutes on a real machine.
- Credentials are the boundary: the agent refers to API keys, keystores and the match passphrase through environment variables but never creates, reads or commits them.
- In CI, match should run read-only and setup_ci should create a temporary keychain – question any diff that removes either.
- Agents cannot answer interactive wizards, so ask for the Appfile and Fastfile to be written directly instead of running fastlane init.
- Upload lanes end at TestFlight or a draft Play release; sending a build to review stays a human decision.
Why fastlane is a good job for a coding agent
fastlane automates the repetitive part of a mobile release: running tests, signing, building the archive or App Bundle, uploading it and pushing store metadata. Its configuration lives in two small Ruby files, the Appfile and the Fastfile, and every action is documented on docs.fastlane.tools. That is close to ideal agent work. Claude Code, Codex, Cursor or Copilot can write a lane, run it, read the error and try again until it passes.
The catch is what fastlane sits next to: the App Store Connect API key, your certificates and provisioning profiles, the Google Play service account and the Android upload key. An agent that "fixes" a signing error by generating a fresh certificate, or by pasting a key into a lane, creates a bigger problem than the one it solved. The setup goes smoothly when that boundary is written down before the first prompt.
What the agent writes – and what stays with you
| Item | The agent | A human |
|---|---|---|
| Gemfile with pinned fastlane, Appfile, Fastfile | Writes the files and runs the lanes | Reviews the diff |
| App Store Connect API key (.p8) | Reads it from environment variables in the lane | Creates it under Users and Access, stores it as a CI secret |
| Certificates and profiles via match | Configures match in read-only mode | Creates the encrypted storage, runs the first match with write access, owns the passphrase |
| Android upload keystore | Wires the Gradle signing config to environment variables | Generates the keystore, backs it up, stores the passwords |
| Google Play service account | Uses the JSON key from a secret | Creates the account and grants it Play Console permissions |
| Build numbers and versionCodes | Implements the increment logic | Chooses the marketing version |
| Store metadata folders | Creates the structure, drafts text | Approves every word before upload |
The human column is about long-lived credentials tied to your company accounts: the agent may explain where to click, but should not hold them afterwards. Our playbook on secrets and API keys in AI-built apps covers where such material belongs.
Talk to an AI Code Engineer about automating your releases with fastlane.
In a free call we look at what you built, tell you honestly what stands between it and an approved release – and whether you need us at all.
A four-session plan for the setup
Short sessions keep each diff reviewable. Start each one in plan mode or your tool's read-only setting and let the agent propose before it edits.
- Inventory. "Read the iOS and Android projects and list the schemes, targets, bundle IDs and application IDs, how signing works today, how version numbers are set and which CI system we use. Do not change files." Compare the answer with reality; wrong identifiers surface here.
- Skeleton. A Gemfile with fastlane pinned, a committed
Gemfile.lock, the Appfile and a Fastfile with one test lane per platform. Ask forbundle exec fastlanein every command and script. - iOS build and TestFlight. API key, match in read-only mode, build number increment, archive and upload. You run match once with write access beforehand, so the certificates exist.
- Android build and Play upload. Release signing from environment variables, App Bundle build, upload to the internal track as a draft.
Ask the agent to write the files directly instead of running fastlane init. The wizard asks interactive questions, and an agent waiting for input it cannot give simply stalls. Store the outcome of session 1 in your memory file – see CLAUDE.md and AGENTS.md for mobile projects – so later sessions start from facts instead of rediscovering them.
The lanes worth having: a minimal Fastfile
A good first Fastfile is short. The scheme and variable names below are placeholders; the actions are standard fastlane actions.
platform :ios do
lane :beta do
setup_ci if ENV["CI"]
api_key = app_store_connect_api_key(
key_id: ENV["ASC_KEY_ID"],
issuer_id: ENV["ASC_ISSUER_ID"],
key_content: ENV["ASC_KEY_CONTENT"]
)
match(type: "appstore", readonly: true, api_key: api_key)
increment_build_number(
build_number: latest_testflight_build_number(api_key: api_key) + 1
)
build_app(scheme: "MyApp", export_method: "app-store")
upload_to_testflight(api_key: api_key, skip_waiting_for_build_processing: true)
end
end
platform :android do
lane :internal do
gradle(task: "bundle", build_type: "Release")
upload_to_play_store(track: "internal", release_status: "draft",
json_key_data: ENV["PLAY_SERVICE_ACCOUNT_JSON"])
end
end
Three details are deliberate. setup_ci creates a temporary keychain on the build machine so signing does not hang on a keychain prompt. readonly: true prevents match from creating or revoking certificates. And skip_waiting_for_build_processing lets the CI job finish while Apple processes the build.
On Android, each upload needs a versionCode higher than anything already on Play. Let the agent derive it from the CI run number or from google_play_track_version_codes, and keep the release on the current target API level – our guide to the target API level requirement explains the deadline.
Reviewing the agent's diff: the red flags
Most of a Fastfile diff is harmless. These lines are not – stop and ask why whenever one appears:
match nuke, orreadonly: falsein a CI lane. Nuke revokes certificates; write access in CI lets any pipeline run create new ones. Apple also caps how many distribution certificates an account may hold.- Apple ID and password instead of the API key. Two-factor prompts break unattended runs; the API key is the supported route for automation.
- Key material near the repository. A
.p8,.jksor service account JSON file staged for commit, or a key pasted into a lane. Check the agent's intermediate commits, not just the final diff, and keep these patterns in.gitignore. submit_for_review: trueor a production track. Upload lanes stop at TestFlight and a draft internal release. Promotion is a click by someone who has read the release notes.force: trueon deliver. It skips the HTML preview that exists so a person looks at metadata before it goes live.- Edits outside fastlane. A changed team ID, bundle identifier, entitlements file or Gradle applicationId while the agent was "only fixing signing".
And make the agent explain every failed run before it changes anything: "signing failed, so I switched to automatic signing" is a decision you want to make yourself.
Running the lanes in CI and keeping them alive
Once both lanes pass locally, the agent can wire them into CI: iOS lanes on a macOS runner with Xcode 26, Android lanes on Linux. Our playbook on GitHub Actions for mobile CI with coding agents covers workflow files, protected secrets and approval gates.
Maintenance is then mostly small: a fastlane update, a renamed scheme, a widget extension that needs its own profile. Give the agent a standing rule – run the test lanes after build setting changes and touch signing lanes only when asked.
If you would rather not own this at all, our AI Code Engineers set up fastlane, match and the pipeline in your own Apple and Google accounts and hand over a documented setup – for iOS and for Android. Teams that want to build it themselves can do so in one of our hands-on workshops, with their own agent and their own repository.
Checklist for agent-written fastlane lanes
- fastlane is pinned in a Gemfile, Gemfile.lock is committed and every call uses bundle exec.
- The App Store Connect API key, match passphrase, upload keystore and Play service account exist only as CI secrets and in your password manager.
- match runs read-only in every CI lane; a human ran the first match with write access.
- setup_ci or an equivalent temporary keychain runs before signing on CI machines.
- Build numbers and versionCodes increase automatically and never collide with existing uploads.
- Upload lanes stop at TestFlight and a draft internal Play release.
- The agent's memory file lists the lanes, the secrets they expect and the files it must not touch.
- Every diff that touches signing, identifiers or entitlements gets a human review before merge.
Frequently asked questions
Can a coding agent create my App Store Connect API key?
No. Creating the key requires signing in to App Store Connect with a role that may manage keys, and the private key file can be downloaded only once. The agent can walk you through the steps and then read the key from an environment variable in its lanes.
Should we use fastlane match or Xcode automatic signing?
For one developer building on one Mac, automatic signing works. As soon as CI or several people build the app, match – or another shared signing approach – keeps every machine on the same certificates instead of each creating its own. Decide this before the agent starts, and write the decision into its memory file.
Which agents can write and test fastlane lanes?
Any agent that runs terminal commands – Claude Code, the Codex CLI, Cursor's agent, Copilot agent mode. iOS lanes need macOS with Xcode, so a Linux cloud agent can write but not test them; Android lanes run anywhere with a JDK and the Android SDK.
Can the agent also manage store metadata and screenshots with fastlane?
Yes. deliver and supply keep listing text and images in folders in the repository, so changes become reviewable diffs. See our playbooks on store screenshots with AI and app store optimization with AI agents.
Can you set up fastlane for us?
Yes. Book a free call and an AI Code Engineer looks at your project. We can set up signing, lanes and CI in your own accounts, or coach your team while it builds the setup with its own agent.
Free, 15 minutes, no obligation
Get your app from agent output to approved release.
Our AI Code Engineers take apps built with Claude Code, Codex, Cursor, Lovable, Base44 and co. through signing, CI/CD, store listings and review – in your own developer accounts.
AI tools, store policies and requirements change quickly – always check the current documentation of the tools and stores you use. This article is independent advice and not affiliated with or endorsed by Apple, Google, Anthropic, OpenAI or any other company or product mentioned; all trademarks belong to their owners.