Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple "Branded" Targets of same underlying App #88

Closed
ehlersd opened this issue Mar 4, 2015 · 19 comments
Closed

Multiple "Branded" Targets of same underlying App #88

ehlersd opened this issue Mar 4, 2015 · 19 comments

Comments

@ehlersd
Copy link

ehlersd commented Mar 4, 2015

My first solution was to setup a separate Fastfile for each branded target....but I'm not seeing a way to specify the Fastfile to use with fastlane.

I'll be integrating shortly with Jenkins (just trying to get a manual process working first).

So, what would be your recommendation as to the best way to setup and utilitize fastlane?

Thanks in advance...

@joshdholtz
Copy link
Member

Hey @ehlersd ,

I think I should be able to help you out here.

⚠️ Official Answer ⚠️

A PR of mine was just merged into master a few days ago (I don't think the gem has been pushed out yet) that allows for multiple environments using dotenv.

Ex: fastlane beta --env brand1 or fastlane beta --env brand2
Here is a gist with that example: - https://gist.github.com/joshdholtz/aa902e7ae28c1c0bea2a

⚠️ Unofficial Answer ⚠️

Since this isn't a "released" feature yet, you can use a gem I wrote that adds this ability AND "brand" specific lanes if you need that - https://github.com/joshdholtz/fastlane-env-lanes

If you use fastlane-env-lanes, you would call fastlane beta:brand1 instead of fastlane beta --env brand1. By using this gem, you can also decorate lanes for a specific brand.

require 'fastlane_env_lanes'

lane :beta do 
  # Only gets called if NO environment/brand is used
  puts "Why are you building without a brand?"
end

lane :beta, :brand1 do
  # Do some specific brand 1 stuff

  # Will load CONFIG and SCHEME from .env.<brand> where brand is brand1 because that is the environment specific lane we are in
    ipa({
        workspace: ENV['WORKSPACE'],
        configuration: ENV['CONFIG'],
        scheme: ENV['SCHEME'],
      })
end

lane :beta, :brand2 do
  # Do some specific brand 1 stuff

  # Will load CONFIG and SCHEME from .env.<brand> where brand is brand2 because that is the environment specific lane we are in
    ipa({
        workspace: ENV['WORKSPACE'],
        configuration: ENV['CONFIG'],
        scheme: ENV['SCHEME'],
      })

end

@ehlersd
Copy link
Author

ehlersd commented Mar 4, 2015

Awesome! Great answer...thx!

@joshdholtz
Copy link
Member

Note: The fastlane-env-lanes also loads the different .env files like my PR does. It just loads it differently :brand instead of --env brand.

Let me know if you need any more help with setting anything up! Always available to help 😁

@KrauseFx
Copy link
Member

KrauseFx commented Mar 4, 2015

@joshdholtz being awesome again 🚀 😀 How about putting this information into its own .md file in the repository and link to it from the README?

@joshdholtz
Copy link
Member

@KrauseFx I can do that! ✊ Let's keep this issue open until I do that

@KrauseFx
Copy link
Member

KrauseFx commented Mar 9, 2015

@joshdholtz I'll assign the issue to you 😉

I'll be working on the big refactoring of the fastlane documentation, so let's wait until that's finished.

@fatuhoku
Copy link

fatuhoku commented Mar 9, 2015

Would love to try this. Wow. iOS tooling has just got even more awesome. 🍻

@KrauseFx
Copy link
Member

@joshdholtz I got asked about the multiple targets again, if you have some time it would really be cool to add a short explanation to the docs folder when you have some time 👍

@jaroslavas
Copy link

I cannot make it load different snapshot config files. Am I doing something wrong?
.env.something:

LOCALIZED_CONFIGS_PATH="./fastlane/s_lt"

Fastfile (doesn't work):

lane :deploy do
  snapshot(
      snapshot_file_path: ENV["LOCALIZED_CONFIGS_PATH"],
    )
end

However, it works if I change it to:

lane :deploy do
  snapshot(
      snapshot_file_path: './fastlane/s_lt',
    )
end

Command: fastlane deploy --env something

It would also be very good if I could use ENV is Snapfile (and other config files) but it also doesn't seem to work.

@KrauseFx
Copy link
Member

@jaroslavas Can you try replacing

LOCALIZED_CONFIGS_PATH="./fastlane/s_lt"

with

export LOCALIZED_CONFIGS_PATH="./fastlane/s_lt"

@jaroslavas
Copy link

Still getting Could not find './Snapfile'

@KrauseFx
Copy link
Member

KrauseFx commented Sep 3, 2015

I'll close this issue for now, thanks @joshdholtz for providing the documentation on how to solve this problem 👍

@KrauseFx KrauseFx closed this as completed Sep 3, 2015
KrauseFx added a commit that referenced this issue Mar 7, 2016
KrauseFx added a commit that referenced this issue Mar 7, 2016
Fix typo in Contributing.md file
KrauseFx pushed a commit that referenced this issue Mar 7, 2016
@cytryn
Copy link

cytryn commented Jun 9, 2016

@joshdholtz and @KrauseFx , any news if fastlane-env-lanes is an official solution by now?

@joshdholtz
Copy link
Member

@cytryn Oh man, I haven't update or ran the repo in a while 😇 I am not sure if it still works but definitely not an official solution 😉

Your best bet would probably be to have a separate .env file for each branch .env.brand1, .env.brand2, etc, and switch on stuff in your lane to a different method or something.

@cytryn
Copy link

cytryn commented Jun 9, 2016

@joshdholtz oh ok. I will definitely try that! Thanks for the update.

@joshdholtz
Copy link
Member

@cytryn No problem! I should also go mark that repo has no longer supported probably 😬

@KrauseFx
Copy link
Member

KrauseFx commented Jun 9, 2016

Correct me if I'm wrong, but dotEnv is already integrated into fastlane, run fastlane --help for more information

@joshdholtz
Copy link
Member

@KrauseFx Yup yup, it is! But @cytryn was asking about my environment specific lanes repo (https://github.com/joshdholtz/fastlane-env-lanes) that I made back in the day. I mentioned that I don't support that and the official solution would be to use the .env.* method that is built in already 👌

@fbensaid
Copy link

fbensaid commented Jul 7, 2016

HI, is there any possible to use gym for a specific target ?

@fastlane fastlane locked and limited conversation to collaborators Dec 6, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants