DevOps for Mobile Apps Demo - November 1, 2021
Recording
Mission
DevOps for Mobile Apps Single-Engineer Group
Our goal is to improve the experience for Developers targeting mobile platforms by providing CI/CD capabilities and workflows that improve the experience of provisioning and deploying mobile apps.
Demos like this one are published each week, you can find previous demos and see new ones when they are finished in the Weekly Demos issue.
Current Update - Code Signing and Beta Releases with Fastlane
iOS Pipeline
Fastlane Match
A new approach to iOS and macOS code signing: Share one code signing identity across your development team to simplify your codesigning setup and prevent code signing issues.
- https://docs.fastlane.tools/actions/match/
- https://codesigning.guide/
- https://docs.fastlane.tools/codesigning/getting-started/#using-match
- Setup walkthrough https://medium.com/@danielvivek2006/setup-fastlane-match-for-ios-6260758a9a4e
Once Match is set up and the Matchfile has been added, configure the MATCH_PASSWORD
in the GitLab project.
App Store Connect API
The App Store Connect API is a REST API that enables the automation of actions you take in App Store Connect.
https://developer.apple.com/documentation/appstoreconnectapi
See the Creating an App Store Connect API Key
section:
https://www.runway.team/blog/how-to-build-the-perfect-fastlane-pipeline-for-ios
Once set up, configure the following environment variables in the GitLab project:
APP_STORE_CONNECT_API_KEY_ISSUER_ID
APP_STORE_CONNECT_API_KEY_KEY_ID
APP_STORE_CONNECT_API_KEY_KEY
Fastlane beta deploy
.gitlab-ci.yml
beta_ios:
image: macos-11-xcode-12
stage: beta
script:
- flutter upgrade
- bundle install
- flutter pub get
- cd ios
- pod install
- flutter build ios --dart-define=YOU_TUBE_API_KEY=${YOU_TUBE_API_KEY} --dart-define=YOU_TUBE_CHANNEL_ID=${YOU_TUBE_CHANNEL_ID} --release --no-codesign
- bundle exec fastlane ios beta
tags:
- shared-macos-amd64
when: manual
allow_failure: true
only:
refs:
- master
Fastfile
desc "Push a new beta build to TestFlight"
lane :beta do
setup_ci
match(type: 'appstore')
app_store_connect_api_key(
is_key_content_base64: true
)
# use https://github.com/tianhaoz95/fastlane-plugin-flutter_version to set version
increment_version_number(
xcodeproj: "Runner.xcodeproj",
version_number: flutter_version()["version_name"] # Version Name
)
increment_build_number(
xcodeproj: "Runner.xcodeproj",
build_number: flutter_version()["version_code"] # Version Code
)
build_app(workspace: "Runner.xcworkspace", scheme: "Runner")
upload_to_testflight
end
Command Reference:
- http://docs.fastlane.tools/actions/setup_ci/
- https://docs.fastlane.tools/actions/match/
- https://docs.fastlane.tools/actions/app_store_connect_api_key/
- https://github.com/tianhaoz95/fastlane-plugin-flutter_version
- https://docs.fastlane.tools/actions/build_app/
- https://docs.fastlane.tools/actions/upload_to_testflight/
Note: A Distribution Certificate is also needed to release to the app store. Instructions to setup a Distribution Certificate can be found here: https://support.staffbase.com/hc/en-us/articles/115003458931-Creating-the-iOS-Distribution-Certificate
Potential Contributions to Fastlane
- https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/readme/-/issues/27
- https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/readme/-/issues/28
- https://gitlab.com/gitlab-org/incubation-engineering/devops-for-mobile-apps/readme/-/issues/29
Additional Resources
Flutter
- CD https://flutter.dev/docs/deployment/cd
- iOS https://flutter.dev/docs/deployment/ios
- Versioning https://medium.com/karlmax-berlin/versioning-with-flutter-299869e68af4
- Fastlane Composition https://dev.to/danielgomezrico/how-to-build-flutter-apps-on-ci-with-fastlane-and-reuse-some-code-2np3
Fastlane
- Dotenv https://docs.fastlane.tools/best-practices/keys/
- CI/CD Workflow https://medium.com/revelo-tech/setting-up-automatic-ios-release-with-fastlane-and-match-on-ci-cd-server-16c3f1d79bc5
- Circle CI docs https://docs.fastlane.tools/best-practices/continuous-integration/circle-ci/
Up Next
- Improve the build efficiency and fix the double compile problem with the beta release step
- Set up a beta release pipeline for the Android version of the app