Giter Club home page Giter Club logo

Comments (19)

joshdholtz avatar joshdholtz commented on April 20, 2024 2

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

from fastlane.

joshdholtz avatar joshdholtz commented on April 20, 2024 1

@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 πŸ‘Œ

from fastlane.

ehlersd avatar ehlersd commented on April 20, 2024

Awesome! Great answer...thx!

from fastlane.

joshdholtz avatar joshdholtz commented on April 20, 2024

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 😁

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

@joshdholtz being awesome again πŸš€ πŸ˜€ How about putting this information into its own .md file in the repository and link to it from the README?

from fastlane.

joshdholtz avatar joshdholtz commented on April 20, 2024

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

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

@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.

from fastlane.

fatuhoku avatar fatuhoku commented on April 20, 2024

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

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

@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 πŸ‘

from fastlane.

jaroslavas avatar jaroslavas commented on April 20, 2024

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.

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

@jaroslavas Can you try replacing

LOCALIZED_CONFIGS_PATH="./fastlane/s_lt"

with

export LOCALIZED_CONFIGS_PATH="./fastlane/s_lt"

from fastlane.

jaroslavas avatar jaroslavas commented on April 20, 2024

Still getting Could not find './Snapfile'

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

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

from fastlane.

cytryn avatar cytryn commented on April 20, 2024

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

from fastlane.

joshdholtz avatar joshdholtz commented on April 20, 2024

@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.

from fastlane.

cytryn avatar cytryn commented on April 20, 2024

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

from fastlane.

joshdholtz avatar joshdholtz commented on April 20, 2024

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

from fastlane.

KrauseFx avatar KrauseFx commented on April 20, 2024

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

from fastlane.

fbensaid avatar fbensaid commented on April 20, 2024

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

from fastlane.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.