fastlane | easiest way to automate building | iOS library
kandi X-RAY | fastlane Summary
Support
Quality
Security
License
Reuse
- Updates the options for the given options .
- Runs command .
- Import certificate file
- Handles the authentication token
- Runs the program .
- Builds the box associated with the title
- Create metadata files from the metadata directory
- Run the command
- Runs the prerequisites .
- Renames the provisioner with the given parameters
fastlane Key Features
fastlane Examples and Code Snippets
Trending Discussions on fastlane
Trending Discussions on fastlane
QUESTION
I'm using Fastlane to automate my iOS and Android releases for my React Native app. It works great I'm just struggling to get the current Android version number to pass into a Slack message once the app has been deployed. Below is my current Android lane:
lane :deploy_staging do
gradle(task: "clean")
puts "CONFIG: #{ENV['CONFIG']}"
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
)
upload_to_play_store(track: 'internal')
slack(
message: "Test successfully deployed to Play Store",
success: true,
slack_url: "https://hooks.slack.com/services/test",
attachment_properties: {
fields: [
{
title: "Environment",
value: "Staging",
}
]
}
)
end
With iOS I run the following to get the version number:
{
title: "Version number",
value: get_version_number(target:"testapp"),
}
But there doesn't seem to be this method call for Android, is there an easy way for me to pull in the version number?
ANSWER
Answered 2021-Nov-03 at 18:27You can set the version code and version name as a local variable and pass them manually to your gradle method. Then use them in your slack method, too. Try something like this:
versionCode = 100
versionName = "1.0.0"
#...
gradle(
task: 'bundle',
build_type: 'Release',
print_command: false,
properties: {
"versionCode" => versionCode,
"versionName" => versionName,
}
)
#...
slack(
message: "Test version code: #{versionCode} and version name: #{versionName} successfully deployed to Play Store",
success: true,
slack_url: "https://hooks.slack.com/services/test",
attachment_properties: {
fields: [
{
title: "Environment",
value: "Staging",
}
]
}
)
QUESTION
I have created an app using React Native and am trying to create an iOS app store build through Expo's eas-cli.
When running eas build --platform ios
the Fastlane build failed with unknown error
After checking the "Run Fastlane" section in the Expo build log, multiple errors are shown:
Error 1:
Resolving Swift Package Manager dependencies...
$ xcodebuild -resolvePackageDependencies -workspace ./AppName.xcworkspace -scheme AppName -configuration Release
▸ Command line invocation:
▸ /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -resolvePackageDependencies -workspace ./AppName.xcworkspace -scheme AppName -configuration Release
▸ resolved source packages:
$ xcodebuild -showBuildSettings -workspace ./AppName.xcworkspace -scheme AppName -configuration Release
Command timed out after 3 seconds on try 1 of 4, trying again with a 6 second timeout...
[stderr] `` attempted to initialize an object with an unknown UUID. `0BD9B0475CB3419D8B91ED1E` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
Detected provisioning profile mapping: {:"AppBundleID"=>"f6b9bcbf-e950-43e3-847c-058bdc2733f9"}
[stderr] `` attempted to initialize an object with an unknown UUID. `0BD9B0475CB3419D8B91ED1E` for attribute: `files`. This can be the result of a merge and the unknown UUID is being discarded.
I have tried to locate UUID 13B07F8E1A680F5B00A75B9A
in my code to no avail. I have also since installed cocoapods with sudo gem install cocoapods
which did not change the error log significantly.
Error 2:
❌ ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '1205.0.22.11.0_0' Reader: '1200.0.32.29_0')', using libLTO version 'LLVM version 12.0.0, (clang-1200.0.32.29)' for architecture arm64
❌ clang: error: linker command failed with exit code 1 (use -v to see invocation)
⚠️ Pods/boost-for-react-native: iOS@8.0 deployment version mismatch, expected >= 9.0 <= 14.4.99
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ Ld /Users/expo/Library/Developer/Xcode/DerivedData/AppName-grbndlkaumowtzhaeqkpzrsevhvm/Build/Intermediates.noindex/ArchiveIntermediates/AppName/InstallationBuildProductsLocation/Applications/appname.app/appname normal
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
Ld /Users/expo/Library/Developer/Xcode/DerivedData/AppName-grbndlkaumowtzhaeqkpzrsevhvm/Build/Intermediates.noindex/ArchiveIntermediates/AppName/InstallationBuildProductsLocation/Applications/appname.app/appname normal
(1 failure)
Exit status: 65
Xcode is up to date at version 12.5.1.
All help is very much appreciated, thank you!
ANSWER
Answered 2021-Oct-06 at 06:11There are a number of things to look into.
If you are running Expo in the SDK then no need for cocoa pods just the most up-to-date version of the CLI tool.
Run expo --version
to determine what version you are currently working with. Update if needed.
Adding a profile might be useful too. Along with checking your config. Configuring EAS Build with eas.json
eas build --platform ios --profile distribution
Also, be sure that all the apple certificates are active and connected to your Expo account for that project.
QUESTION
I am using React-native for my app. I have named my name reactamplify
. I want to deploy my app to Google play-store. For automation deployment I am using first time fastlane
. I found this documentation, follow the steps and give API grant access. In my React native app, I navigate to android
folder then run this command fastlane init
. Give json_key_file
path my downloaded auth json file. But I got confused about package name. I search my app name in vscode com.reactamplify
replace them into com.example.todo
. Then run android folder fastlane supply init
, I am getting this error: [!] Google Api Error: Invalid request - Package not found: com.example.todo.
I really don't know how to fix it :(. Really lost TBH.
When I run fastlane supply
. I got this image
PS: It would be awesome if someone gives me example with images
ANSWER
Answered 2021-Oct-29 at 04:46I found the reason. I need to upload at least one build to google Play store app manually. That’s why I got package name error.
QUESTION
I am using M1 pro macbook and ad-hoc distribution fails. The wired thing is that distribute to appstore succeed. i am using fastlane for CLI and pods for frameworks
Xcode : 13.2.1 (13C100)
Ruby : ruby 2.6.8p205
Note:
i have tried using Rosseta
i have tried upgrade min version to iOS 13 (my current is 11)
ANSWER
Answered 2022-Mar-16 at 11:59probably i have changed The xcode ruby, and formatting the computer solve my issue
QUESTION
I'm trying to upload an android apk to my self-created closed test track via "fastlane supply".
According to the merged pull request, it is possible (https://github.com/fastlane/fastlane/pull/12487)
supply ( track: 'alpha', apk: "build / app / outputs / apk / release / app-release.apk" )
I've already tried to write the name of the new track or custom on attribute track. But always get the error message that the track does not exist.
The upload generally works, it just doesn't load it into my desired track.
How do I have to define it so that the apk is loaded into the new track
I also tried to pause the alpha track so that only my new track is active, but it didn't work either.
ANSWER
Answered 2021-Oct-15 at 10:00The problem wasn't the attribute or the method, but the naming of the track.
I worked with upper and lower case, or with hyphens.
The following naming in fastlane and in Google Console works fine:
supply ( track: "alphaa", apk: "build/app/outputs/apk/release/app-release.apk" )
QUESTION
I'm trying to build & upload to Apple Developer an iOS app built with react-native.
Here is the command I'm executing :
bundle exec fastlane beta
And here is the error I'm getting during the 'build app' step :
[15:57:22]: $ set -o pipefail && xcodebuild -workspace mobile.xcworkspace -scheme mobile -destination 'generic/platform=iOS' -archivePath /Users/myuser/Library/Developer/Xcode/Archives/2022-01-24/myapp\ 2022-01-24\ 15.57.22.xcarchive archive | tee /Users/myuser/Library/Logs/gym/myapp-mobile.log | xcpretty
[15:57:25]: ▸ The Legacy Build System will be removed in a future release. You can configure the selected build system and this deprecation message in File > Workspace Settings.
[15:57:25]: ▸ Building Pods/DoubleConversion [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Building Pods/glog [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Aggregate Pods/FBLazyVector [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Aggregate Pods/boost-for-react-native [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Aggregate Pods/RCTRequired [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Building Pods/React-Core-AccessibilityResources [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Processing ResourceBundle-AccessibilityResources-React-Core-Info.plist
[15:57:25]: ▸ Copying /Users/myuser/Documents/myapp/mobile/node_modules/react-native/React/AccessibilityResources/en.lproj
[15:57:25]: ▸ ❌ error: /Users/myuser/Documents/myapp/mobile/node_modules/react-native/React/AccessibilityResources/en.lproj: No such file or directory
[15:57:25]: ▸ Aggregate Pods/React-callinvoker [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ Building Pods/React-jsinspector [Release]
[15:57:25]: ▸ Check Dependencies
[15:57:25]: ▸ ** ARCHIVE FAILED **
[15:57:25]: ▸ The following build commands failed:
[15:57:25]: ▸ CpResource /Users/myuser/Documents/myapp/mobile/node_modules/react-native/React/AccessibilityResources/en.lproj /Users/myuser/Library/Developer/Xcode/DerivedData/mobile-bcscdkevmsgdkxgqwricfjclvmqw/Build/Intermediates.noindex/ArchiveIntermediates/mobile/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle/en.lproj
[15:57:25]: ▸ (1 failure)
I updated "bundle"'s version and tried to check "Legacy Build" on Xcode but it didn't bring anything. I'm kinda stuck with this error.
Already tried to remove node_modules and run npm install
, and nothing changed. I feel like this file not found has to be built during the npm install command.
ANSWER
Answered 2022-Jan-26 at 08:03Ok, so I kind of fixed it.
What I did was to reinstall npm & nvm with homebrew, delete the package-lock.json and then run npm install
. For some reasons, I didn't have any folders named "node_modules" and my package-lock didn't contain any lines with the module "react-native" so I added it back.
Now I'm stuck with something else but I guess I'll have to open a new ticket !
QUESTION
Hey guys is my first time when I use fastlane and after I've managed to configure fastlane successfully I ran 'fastlane beta' in my iOS folder and got into this error after 10 minutes of processing
▸ Processing Info.plist
▸ Running script 'Bundle React Native code and images'
the transform cache was reset.
▸ Generating 'Vert.app.dSYM'
** ARCHIVE FAILED **
The following build commands failed:
PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/IntermediateBuildFilesPath/Vert.build/Release-iphoneos/Vert.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'Vert' from project 'Vert')
(1 failure)
[11:03:05]: Exit status: 65
+-------------+-------------------------------------+
| Build environment |
+-------------+-------------------------------------+
| xcode_path | /Volumes/Work/Applications/Xcode.a |
| | pp |
| gym_version | 2.199.0 |
| sdk | iPhoneOS15.0.sdk |
+-------------+-------------------------------------+
[11:03:05]: ▸ Command PhaseScriptExecution failed with a nonzero exit code
[11:03:05]: ▸ GenerateDSYMFile /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/Vert.app.dSYM /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/InstallationBuildProductsLocation/Applications/Vert.app/Vert (in target 'Vert' from project 'Vert')
[11:03:05]: ▸ cd /Volumes/Work/Desktop/workspace_es/development-rider/ios
[11:03:05]: ▸ /Volumes/Work/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/InstallationBuildProductsLocation/Applications/Vert.app/Vert -o /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/Vert.app.dSYM
[11:03:05]:
[11:03:05]: ⬆️ Check out the few lines of raw `xcodebuild` output above for potential hints on how to solve this error
[11:03:05]: 📋 For the complete and more detailed error log, check the full log at:
[11:03:05]: 📋 /Users/mariushincu/Library/Logs/gym/Vert-Vert.log
[11:03:05]:
[11:03:05]: Looks like fastlane ran into a build/archive error with your project
[11:03:05]: It's hard to tell what's causing the error, so we wrote some guides on how
[11:03:05]: to troubleshoot build and signing issues: https://docs.fastlane.tools/codesigning/getting-started/
[11:03:05]: Before submitting an issue on GitHub, please follow the guide above and make
[11:03:05]: sure your project is set up correctly.
[11:03:05]: fastlane uses `xcodebuild` commands to generate your binary, you can see the
[11:03:05]: the full commands printed out in yellow in the above log.
[11:03:05]: Make sure to inspect the output above, as usually you'll find more error information there
[11:03:05]:
+------------------+----------+
| Lane Context |
+------------------+----------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| BUILD_NUMBER | 28 |
+------------------+----------+
[11:03:05]: Error building the application - see the log above
+------+------------------------+-------------+
| fastlane summary |
+------+------------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------------+-------------+
| 1 | default_platform | 0 |
| 2 | increment_build_numbe | 2 |
| | r | |
| 💥 | build_app | 743 |
+------+------------------------+-------------+
[11:03:05]: fastlane finished with errors
This is what I found on the end of the actual log in Vert-Vert.log file
node --max-old-space-size=8192 /volumes/work/desktop/workspace_es/development-rider/node_modules/react-native/cli.js bundle --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/main.jsbundle --assets-dest /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/Vert.app --minify false
warning: the transform cache was reset.
Welcome to Metro!
Fast - Scalable - Integrated
error SHA-1 for file /volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js) is not computed.
Potential causes:
1) You have symlinks in your project - watchman does not follow symlinks.
2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.
ReferenceError: SHA-1 for file /volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/node-haste/DependencyGraph/assets/empty-module.js) is not computed.
Potential causes:
1) You have symlinks in your project - watchman does not follow symlinks.
2) Check `blockList` in your metro.config.js and make sure it isn't excluding the file path.
at DependencyGraph.getSha1 (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/node-haste/DependencyGraph.js:245:13)
at Transformer.transformFile (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/DeltaBundler/Transformer.js:104:23)
at Bundler.transformFile (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/Bundler.js:48:30)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:94:5)
at async Object.transform (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/lib/transformHelpers.js:101:12)
at async processModule (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/DeltaBundler/traverseDependencies.js:137:18)
at async addDependency (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/DeltaBundler/traverseDependencies.js:230:18)
at async Promise.all (index 0)
at async processModule (/volumes/work/desktop/workspace_es/development-rider/node_modules/metro/src/DeltaBundler/traverseDependencies.js:198:5)
info Run CLI with --verbose flag for more details.
Command PhaseScriptExecution failed with a nonzero exit code
GenerateDSYMFile /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/Vert.app.dSYM /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/InstallationBuildProductsLocation/Applications/Vert.app/Vert (in target 'Vert' from project 'Vert')
cd /Volumes/Work/Desktop/workspace_es/development-rider/ios
/Volumes/Work/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/dsymutil /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/InstallationBuildProductsLocation/Applications/Vert.app/Vert -o /Users/mariushincu/Library/Developer/Xcode/DerivedData/Vert-dumzflwpkmrgprcgqfpxkqvpyyyw/Build/Intermediates.noindex/ArchiveIntermediates/Vert/BuildProductsPath/Release-iphoneos/Vert.app.dSYM
I want to mention that I've tried to make the archive from Xcode after this error and it finished it successfully without any error.
Can anyone explain to me what should be the reason?
ANSWER
Answered 2022-Jan-04 at 12:59I have managed to solve this problem by creating a fastlane folder in the root folder of my react-native project and inside that I have initiated the fastlane command. Before I used to have the fastlane folder inside iOS folder.
Now the folder structure looks like this
- Root
- android
- ios
- fastlane
- Appfile
- Fastfile
- Gemfile
- Gymfile
QUESTION
We can build and run Swift code/projects from the command line via multiple commands without using Xcode. I have heard of xcodebuild
, xcrun
and swift
used for Xcode development. I do use fastlane
but I don't really understand the tools powering it under the hood.
I am an iOS developer who uses a Mac. I develop using Xcode so I haven't used these command-line tools before.
What are the differences between each command? Are there any cases where I'd be better off using one over the other?
ANSWER
Answered 2021-Sep-13 at 17:36xcodebuild
and xcrun
help build Xcode projects in a headless context, for example in CI setups. swift
is the Swift REPL and is largely used for Swift on Server apps. As such, we can build apps without knowing about or using the tools regularly in mobile app development. We use xcodebuild
and xcrun
under the hood interacting with Xcode even though we don't realise it because they're bundled in Xcode's Command Line tools (documentation archive, but still relevant).
fastlane
is an example CI tool that automates the build process, certificate signing, and interfacing with App Store Connect, using these tools.
xcodebuild
is part of Xcode's bundled command-line tools package. From the manpages:
build Xcode projects and workspaces
xcodebuild builds one or more targets contained in an Xcode project, or builds a scheme contained in an Xcode workspace or Xcode project.
xcodebuild
has lots of options and use cases. The options are equivalent to certain user actions within the Xcode IDE. Example usage:
xcodebuild -workspace MyWorkspace.xcworkspace -scheme MyScheme
Builds the scheme MyScheme in the Xcode workspace MyWorkspace.xcworkspace.
In the command above, we build the workspace without Xcode, using what Xcode runs internally for compilation. Xcode can only be installed on macOS and we have the same limitations for using its command-line tools, including xcodebuild
and xcrun
.
xcrun
is another Xcode command-line tool part of Xcode's CLI tools. From the manpages:
run or locate development tools
xcrun
provides a means to locate or invoke coexistence- and platform-aware developer tools from the command-line, without requiring users to modify makefiles or otherwise take inconvenient measures to support multiple Xcode toolchains.
xcrun [-sdk SDK] -find
xcrun
is also commonly used with Xcode-select
to manage multiple Xcode versions on the same machine. Every version of Xcode comes bundled with its own development tools, and we can use xcrun
to get the current path to them:
xcrun xcode-select --print-path
swift
is the Swift REPL. swift
is a command-line tool that includes the Swift toolchain but can also be installed outside of the Xcode bundled tools. swift
is different from xcodebuild
and xcrun
because it is compiled Swift rather than C. swift
is not well documented in the MacOS manpages documentation, however, Apple has documented these tools on its blog:
Xcode 6.1 introduces yet another way to experiment with Swift in the form of an interactive Read Eval Print Loop, or REPL.
A REPL is essentially an interactive compilation environment or shell. First, the REPL reads code, then evaluates it, prints, and repeats the process. As you can imagine, there is much less we can develop using a REPL compared to an IDE. However, there are other use cases for Swift than iOS, watchOS, and macOS development.
swift
includes the standard library and doesn't include libraries such as Foundation
and UIKit
. These Swift libraries are almost certainly needed for iOS or macOS development, so we can't develop apps using the swift
REPL alone. However, Swift on Server projects regularly use swift
to run Swift code on Linux and even Windows machines.
For wider adoption, Apple has made swift
available on different Operating Systems where Xcode is not readily available. Swift now also has Docker support and Windows. Docker enables us to run swift
on any machine regardless of the underlying OS. swift
in these applications serves as a scripting language.
swift
is used largely for Swift on Server. Swift on Server has great performance for server applications, with a lower memory footprint, fast startup time, and deterministic performance. Although it is not quite as fast as .NET core for some tasks, this is because Swift is much safer with a rigorous type system, garbage collection with ARC, and fewer optimisations for server-specific apps. Many early adopters praise the improved language type system, memory efficiency, and algorithmic performance. In fact, Swift vapor is comparable to Python and Ruby in efficiency for JSON Serialization tasks. Swift is comparable to Java in very few tasks, but this is likely to change as the language and ecosystem grow.
QUESTION
I'm having an issue why trying to build a KMM project using a Jenkins pipeline and fastlane for the iOS part.
Kotlin version: 1.5.31
XCode version: 13.1
Fastlane version: 2.198.1
Ruby version: 2.6.3p62
When executing these steps locally it breaks as well. The Error that fastlane throws is import shared: no such module 'shared'
I figured out that if you run pod install && fastlane xcode_build
the build brakes, but if you repeat it a second time it succeeds and creates the project.app file in the DerivedData folder of XCode.
The Jenkinsfile is working correctly on another iOS project which is not a KMM one.
Here is the Jenkinsfile
pipeline {
options {
buildDiscarder(logRotator(numToKeepStr: '5', artifactNumToKeepStr: '5'))
}
environment{
FIREBASE_APP = 'some-app'
FIREBASE_TOKEN = 'some-token'
YOUR_CRED = credentials('KeychainPassword')
PROJECT_NAME = 'project'
}
agent any
stages {
stage("Build and Deploy") {
parallel {
stage("iOS") {
agent { label 'ios' }
stages {
stage('Unlock Keychain') {
steps {
sh 'security unlock-keychain -p ${YOUR_CRED} /Users/chocho/Library/Keychains/login.keychain'
}
}
stage("Build") {
steps {
dir("${PROJECT_NAME}-ios"){
sh "pod install"
sh "fastlane xcode_build"
}
}
}
stage("Archive") {
steps {
sh "cp -r ~/Library/Developer/Xcode/DerivedData/${PROJECT_NAME}-ios*/Build/Products/Debug-iphonesimulator/${PROJECT_NAME}-ios.app ./"
sh "zip -r simulator.zip ./${PROJECT_NAME}-ios.app"
archiveArtifacts artifacts: 'simulator.zip', fingerprint: true
}
}
stage('Clean'){
steps{
sh "rm -rf ~/Library/Developer/Xcode/DerivedData/${PROJECT_NAME}*"
}
}
stage("Upload") {
// when { branch 'develop' }
steps {
dir("${PROJECT_NAME}-ios/fastlane"){
sh "fastlane test_flight_develop build_number:${BUILD_NUMBER}"
}
}
}
}
post {
always {
sh "rm -rf ~/Library/Developer/Xcode/DerivedData/${PROJECT_NAME}-ios*"
cleanWs()
}
}
}
stage("Android") {
agent { label 'ios' }
stages {
stage("Clean") {
when { branch 'develop' }
steps {
sh './gradlew clean'
}
}
stage("Build") {
when { branch 'develop' }
steps {
sh "./gradlew assembleRelease -Pandroid.injected.version.code=${BUILD_NUMBER}"
}
}
stage("Archive") {
when { branch 'develop' }
steps {
sh "cp ${PROJECT_NAME}-android/build/outputs/apk/release/${PROJECT_NAME}-android*.apk ./${PROJECT_NAME}-android.apk"
archiveArtifacts "${PROJECT_NAME}-android.apk"
}
}
stage("Upload") {
when { branch 'develop' }
steps {
sh "firebase appdistribution:distribute \
${PROJECT_NAME}-android.apk \
--token ${FIREBASE_TOKEN} \
--app ${FIREBASE_APP} \
--groups 'group'"
}
}
}
post {
always {
cleanWs()
}
}
}
}
}
}
}
And here is the Fastfile that I use for fastlane
default_platform :ios
platform :ios do
lane :xcode_build do
xcodebuild(
scheme: schemeAndTarget,
workspace: schemeAndTarget + '.xcworkspace',
xcargs: "-configuration 'Debug' -sdk 'iphonesimulator15.0' -destination 'generic/platform=iOS Simulator'")
end
end
And here is the Podfile
target 'project-ios' do
use_frameworks!
platform :ios, '14.5'
pod 'shared', :path => '../shared'
pod 'R.swift', '5.4.0'
pod 'SwiftLint', '0.45.0'
end
My question is, since I'm not competent enough with KMM. Why is it doing that? How am I intended to build the project for CI/CD, if the above is not a competent way of doing it.
ANSWER
Answered 2021-Dec-16 at 12:13so I figured it out. If anyone has the same issue, the fix for this current problem is that you have to run a gradle task in the root directory of the project, before building the iOS part.
./gradlew generateDummyFramework
In my case with Jenkins I added sh './gradlew generateDummyFramework
before the sh 'pod install'
shell command in the Build stage. This fixed the issue in question.
The problem was caused from Cocoapods not being able to access the framework file, hence pod install
can't configure the framework correctly. The reason for the build to fail on the first build but not on the second is because the framework file is generated when you run a build in XCode. After that Cocoapods can configure the file correctly.
If anyone has a different answer I'm eager to know about it!
QUESTION
when I using fastlane to publish ios app in github:
- name: Deploy to TestFlight/PGY
run: |
cd ./ios
bundle exec fastlane beta
env:
FLUTTER_ROOT: ${{ secrets.FLUTTER_ROOT }}
APPLE_ID: ${{ secrets.APPLE_ID }}
GIT_URL: ${{ secrets.GIT_URL }}
PGY_USER_KEY: ${{ secrets.PGY_USER_KEY }}
PGY_API_KEY: ${{ secrets.PGY_API_KEY }}
TEAM_ID: ${{ secrets.TEAM_ID }}
ITC_TEAM_ID: ${{ secrets.ITC_TEAM_ID }}
FASTLANE_USER: ${{ secrets.FASTLANE_USER }}
FASTLANE_PASSWORD: ${{ secrets.FASTLANE_PASSWORD }}
FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD: ${{ secrets.FASTLANE_APPLE_APPLICATION_SPECIFIC_PASSWORD }}
FASTLANE_SESSION: ${{ secrets.FASTLANE_SESSION }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
shows this error:
No code signing identity found and can not create a new one because you enabled `readonly`
this is the part of the log:
+-----------------------+---------+--------+
| Used plugins |
+-----------------------+---------+--------+
| Plugin | Version | Action |
+-----------------------+---------+--------+
| fastlane-plugin-pgyer | 0.2.2 | pgyer |
+-----------------------+---------+--------+
[14:58:29]: Sending anonymous analytics information
[14:58:29]: Learn more at https://docs.fastlane.tools/#metrics
[14:58:29]: No personal or sensitive data is sent.
[14:58:29]: You can disable this by adding `opt_out_usage` at the top of your Fastfile
[14:58:29]: ------------------------------
[14:58:29]: --- Step: default_platform ---
[14:58:29]: ------------------------------
[14:58:29]: Driving the lane 'ios beta' 🚀
[14:58:29]: --------------------------
[14:58:29]: --- Step: xcode_select ---
[14:58:29]: --------------------------
[14:58:29]: Setting Xcode version to /Applications/Xcode_12.4.app for all build steps
[14:58:29]: -----------------------------
[14:58:29]: --- Step: create_keychain ---
[14:58:29]: -----------------------------
[14:58:29]: Found keychain '~/Library/Keychains/***', creation skipped
[14:58:29]: If creating a new Keychain DB is required please set the `require_create` option true to cause the action to fail
[14:58:29]: $ security list-keychains -d user
[14:58:29]: ▸ "/Users/runner/Library/Keychains/***-db"
[14:58:29]: Found keychain '/Users/runner/Library/Keychains/***-db' in list-keychains, adding to search list skipped
[14:58:29]: -------------------
[14:58:29]: --- Step: is_ci ---
[14:58:29]: -------------------
[14:58:30]: -------------------
[14:58:30]: --- Step: match ---
[14:58:30]: -------------------
[14:58:30]: Successfully loaded '/Users/runner/work/flutter-netease-music/flutter-netease-music/ios/fastlane/Matchfile' 📄
+----------------+-----------------------------------------------------------------------------------------------------------------+
| Detected Values from './fastlane/Matchfile' |
+----------------+-----------------------------------------------------------------------------------------------------------------+
| git_url | *** |
| git_branch | master |
| storage_mode | git |
| type | adhoc |
| app_identifier | ["com.reddwarf.musicapp"] |
| username | *** |
+----------------+-----------------------------------------------------------------------------------------------------------------+
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
| Summary for match 2.191.0 |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
| app_identifier | ["com.reddwarf.musicapp"] |
| git_url | *** |
| type | adhoc |
| readonly | true |
| keychain_name | *** |
| generate_apple_certs | true |
| skip_provisioning_profiles | false |
| username | *** |
| team_id | *** |
| storage_mode | git |
| git_branch | master |
| shallow_clone | false |
| clone_branch_directly | false |
| force | false |
| force_for_new_devices | false |
| skip_confirmation | false |
| skip_docs | false |
| platform | ios |
| derive_catalyst_app_identifier | false |
| fail_on_name_taken | false |
| skip_certificate_matching | false |
| skip_set_partition_list | false |
| verbose | false |
+--------------------------------+-----------------------------------------------------------------------------------------------------------------+
[14:58:30]: Cloning remote git repo...
[14:58:30]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
[14:58:30]: Checking out branch master...
[14:58:30]: 🔓 Successfully decrypted certificates repo
[14:58:30]: Couldn't find a valid code signing identity for distribution... creating one for you now
+---------------------------+-----------------------------------------------------+
| Lane Context |
+---------------------------+-----------------------------------------------------+
| DEFAULT_PLATFORM | ios |
| PLATFORM_NAME | ios |
| LANE_NAME | ios beta |
| KEYCHAIN_PATH | ~/Library/Keychains/*** |
| ORIGINAL_DEFAULT_KEYCHAIN | "/Users/runner/Library/Keychains/***-db" |
+---------------------------+-----------------------------------------------------+
[14:58:30]: No code signing identity found and can not create a new one because you enabled `readonly`
+------+------------------+-------------+
| fastlane summary |
+------+------------------+-------------+
| Step | Action | Time (in s) |
+------+------------------+-------------+
| 1 | default_platform | 0 |
| 2 | xcode_select | 0 |
| 3 | create_keychain | 0 |
| 4 | is_ci | 0 |
| 💥 | match | 0 |
+------+------------------+-------------+
[14:58:30]: fastlane finished with errors
what should I do to fix the problem?
ANSWER
Answered 2021-Dec-01 at 05:39I see that is_ci
also ran. Does your match
command look like this: match(.., readonly: is_ci, ...)
and are you running the command on a CI service like Jenkins or some other one? If so, run it locally first, that will generate all the relevant certs and provisioning profiles needed. Then run it on your CI service again.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install fastlane
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page