I have been coding my ionic2 project for a while, it not ready, but ready enough.So I have been reasearching and it seems that Fastlane is the fastest way to “deploy” code to Google Play and AppStore. Is there any plans to support it out of the box? Is there any reference I can base myself upon?
I’m a fan of fastlane as well. While we’re not planning on adding support/integration anytime soon, there’s nothing really stoping you from using it.
My problems is that the platforms folder is by default being ignored by git.
As I far as I got into Fastlane, I need to run fastlane init on the android or ios folder.
So all my work is being ignored and lost.
How do you deal with this @mhartington ?
I’d imagine that you could go into your project’s .gitignore file and remove ‘platforms’ from it so that you can commit it.
+1 friends recommended it a lot, so would be ideal to have fastlane support. However, given ionic is to build ionic.io, in some sense they might be competing with fastlane in some functionalities, I don’t know it’s their best of interest though. I won’t speculate…
You can do fastlane init in your app folder. It will create a dir where configs are stored and you can version control it. Only real issue is you need to modify Xcode project to use snapshot, and the changes will be lost if you rm/add ios platform. There’s probably a way to script your way out of it though!
I got it to work once. But then I fucked up on the Google console somewhere. I will have some time today to try again,
Please write back setup instructions so it becomes easier for others. Thanks for your support: )
Hi everyone on this thread, I managed to successfully create my fastlane file, FYI
Hope it helps.
Does this take screenshots automatically as well?
I haven’t gone that far yet
I’m trying to use fastlane with my ionic project now, the following is what I’m trying:
- init fastlane
It is very easy by run
fastlane initin each specific platform directories:
ionic platform add ios android
- platforms directory is ignored by git
I changed my .gitignore to this so that it can include the fastlane directory:
- "the changes will be lost if you rm/add ios platform"
This issue stops me to put fastlane in
platforms/ios/directory, then what I’m trying to do is to move fastlane directory up, and do a symlink to ios/android directory
mv platforms/ios/fastlane fastlane/ios
mv platforms/android/fastlane fastlane/android
ln -s …/…/fastlane/ios platforms/ios/fastlane
ln -s …/…/fastlane/android platforms/android/fastlane
It looks so far so good. However I’m expriencing a issue with relative directory problem with symlink with android platform:
[!] Couldn’t find gradlew at path ‘/Users/zixia/git/wechaty-ionic-creator/fastlane/gradlew’
This is because the fastlane program want to find
gradlew from it’s parent directory, which is not work right with symlink.
Will working on it later.
would it update the build html files on update or it will upload the whole apk to the playstore and will need to wait for approvals?
@nylex – You’d need to do the Ionic building, Fastlane does the distribution.
I’m actually working on a blog series detailing how I implemented Cordova projects w/ Fastlane, which will cover Ionic 1. I just need more free time to finish up.
Any progress with making this work?
Any update on these blog posts?
Would you believe that I’ve had nearly no time in 4 months?!
I do have the first part of my series blogged out, which covers setting up Fastlane for your development environment. I’d appreciate feedback on my writing style and how succinct (or convoluted) it is.
When time permits, I’ll hop back on. To be transparent, it’s a project I’ve wrapped up for two or three of our Ionic v1 projects and due to network restrictions, haven’t had much luck getting apps up to iTunesConnect. Now Apple’s gone and revamped the damn thing to have custom test groups, which is awesome, but adds another step to my documentation.
I’ve managed to find a workaround, continuing in on from what you were working through. So to recap - the issue is that the fastlane expects to live in the platform’s project root, so putting it under /platforms/android/fastlane will work, however this is no good because this folder is excluded from source control and if you perform add/rm platform it will delete your fastlane configs.
The work around I found to install fastlane in the root of your ionic project (which is preferable if you are doing multi platform), and to wrap all the android actions in a chdir do;
/ /fastlane - fastfile /platforms # default generated by cordova /android /src - google-play.json
desc "Deploy a new version to the Google Play" lane :deploy do # build ionic with cordova build Dir.chdir("../platforms/android/src") do # code here runs in the parent (android) directory gradle(task: "assembleRelease") supply(json_key: "./google-play.json", package_name: "mypackage.name") end end
Dir.chdir will run the wrapped commands as if it’s inside that folder, which will fix the issue with “can’t find grandlew in …”. This is a standard ruby thing.
The path that I’m using seems a little odd at first though. You would expect it to be
./platforms/android, but instead I had to use
../platforms/android/src. There’s two things here, the first is that the path is relative to the fastfile, so it starts with …/ to go up to the project root. The second is the /src on the end. This is a real folder, but it’s only referenced as a ‘dummy’ folder. The android scripts exist in the /platforms/android folder.
The reason for the dummy folder is because fastlane itself lives in the subfolder fastlane, but is executed from the parent folder (project root), it has built in logic to look in the parent (root). So if you reference
/platforms/android, you’ll get an error saying “can’t find gradlew in /platforms”, because its actually looking at the parent. So I’m referencing the subfolder expecting it to be dropped. There is some documentation about this behaviour from fastlane - https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Advanced.md#directory-behavior
It’s a bit of a hack but it seems to be working well for me.
The only issue that I’ve found is because of this folder hack, the fastlane functions such as
supply won’t see the external fastlane files (supplyfile in my example) so I’ve had to revert to specifying all the settings inline as per my example. This is because fastlane would be looking for the the file in
./platforms/android/fastlane/[supplyfile] instead of
/fastlane/[supplyfile] due to the chdir.
This isn’t ideal but so far it hasn’t been a deal breaker for me. It’s important to note that this isn’t necessary for iOS.
I’ve come across this fastlane ionic plugin that appears to keep the fastlane config(s) out of the platform directories:
This “only” works for iOS screenshots via Fastlane though.
(I am working on a better solution here, but need some more time to properly document it)