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
Added environments with dotenv #28
Conversation
|
Ha, I love your pull request summaries, thank you! Looking forward to what you're preparing right now 😄 |
@KrauseFx I think it's ready for you!! 💵 💰 💸 Chat me up if you have any questions on anything |
@KrauseFx Updated! |
Hey @joshdholtz, thanks for this great pull request. Why limit it to one sublane? How is it different from just defining a number of lanes when running Just want to understand the use cases for this and how we can use it 😃 |
Hi! I've been playing with @joshdholtz's code and I got it to work in a way that solves the problem raised in #8. In my company, we also use the same codebase with multiple targets that generate multiple apps. Using @joshdholtz change, I can create Although @joshdholtz's code works, I think this feature should be a bit more integrated. It creates the concept of sublanes but then it's just an additional argument for I built scripts for Android that do essentially the same, deploy code loads common config values and overrides them with specific config values for the apps. Currently, using @joshdholtz's patch, my before_all do |lane, sublane|
envfile = '.env.'+sublane.to_s
raise "No env file for "+sublane.to_s unless File.exist? envfile
Dotenv.load('.env')
Dotenv.load(envfile)
raise "No scheme detected" unless ENV['SCHEME']
ENV['SNAPSHOT_SCHEME'] = ENV['SCHEME']
end
lane :snapshots do
snapshot
end Then I call There are still some hiccups, like, Cheers |
Thanks @carlosefonseca!
What are you referring to? Is there an issue with the I'll go through the other points later today 👍 |
@carlosefonseca Thanks for giving this PR a try 😁 I originally did not integrate in the Example: I just got home from a weekend a trip so I will add that in once I get into the office later today. cc: @KrauseFx |
@KrauseFx @carlosefonseca I updated this PR to autoload @KrauseFx I would still like to add more tests yet and I also need to add README stuff. It also looks like there will be a merge conflict so you will need to manually merge this since I do not have write access 😇 |
@KrauseFx The sublanes addition DOES offer some of the same functionality as running multiple lanes in a row. Ex: However, with my latest additions, the I am open to suggestions though if you would like this reworked 😁 |
Hi guys, I've also been playing around with targets, sublanes and .env* files. Works quite well so far and thanks for the input! Environment variable for the screenshots path.The first thing I noticed is that when I use an environment variable for the screenshots path, both in the Snapfile and the Deliverfile, like this:
the
with the error:
Creating the screenshots works as expected. Just the HTML generator has a problem obviously. So far I couldn't resolve the issue. Maybe anyone has a hint. Environment variable for the ipa path.The second thing I noticed is that when I use an environment variable for the ipa path like this:
the
I had to So the line looks like this now:
I could create a Pull Request, but I'm not sure if this occurs if you don't use sublanes and ENV variables. @KrauseFx Please tell me how you feel about this. |
@mathaeus these are all really good points! Unfreezing the string makes sense. But both issues don't have anything to do with the sublanes, right? |
@KrauseFx I'd say so. I create a PR for the unfreezing of the string. The problem with the screenshots path is not tied to sublanes, no. But I guess it only occurs using ENV variables or did other users experience the same problem w/o ENV variables? |
@mathaeus Actually I ran into this issue just today, when releasing the new version of |
@KrauseFx So this issue isn't related to sublanes, correct? 😇 Also, is the idea of sublanes and this implementation alright? If so, I will work on making changes to the README (unless you want to do that so you have more control). |
@joshdholtz not related. About the pull request: Loading the |
@KrauseFx They are a bit cleaner to use than separate methods. They keep the Fastfile syntactically consistent. Ex: I have a specific beta lane for production that goes to Apple TestFlight Beta and the catch all beta lane that goes to HockeyApp lane :beta, :prod do
# Does Apple TestFlight stuff
end
lane :beta do
# Does hockey app stuff
end Instead of adding another symbol into the lane, I could just change it to passing the sublane through the block as an argument. I personally prefer the look of this over separating things out with methods but I am pretty biased 😉 Also, I have 5 targets and 3 environments in my project I created this for. This gave me a lot of flexibility for all my different builds. Also note, this comment was done through my phone so sorry for any markdown errors as I couldn't preview 😬 |
@joshdholtz @KrauseFx how about adding just a flag on |
@carlosefonseca @KrauseFx I can get behind that. I will make that change. |
You know, you can already run multiple lanes with
|
@KrauseFx How about this… can I have a lane run another lane? Can I have a lane called |
@KrauseFx @carlosefonseca Changed it up. The environment is now passed in through a CLI option. This makes this PR a lot simpler now. Example: Just so you know... 😊 |
@joshdholtz Holy cow! That decorator seems works like a charm! Many thanks! |
@carlosefonseca Glad you like it 😁 |
Curious as to the status of this PR. I'm a bit torn myself on the utility of the sublanes, but the addition of dotEnv is very much desired. If there's further discussion about the setup of sublanes, would it be worth splitting this PR into two - one for dotEnv and one for continued work on sublane integration? |
@dfranzi The sublanes are completely removed from this PR. This PR only contains the If you want to use |
Thanks for the heads up! That works in the interim. |
@dfranzi No problem! That is the reason why I made it 😁 |
Added sublanes Can call sublane with : now, along with __ Moved common things to helpers and will now load dotenv with sublane name Makes sure default env files do get loaded Dotenv was not loading out of the fastfile directory... so I fixed that Removed sublane and added env option Moved up setting of ENV Updated gemfile
@KrauseFx Rebased from master and squashed 8 commits together because there was a lot of back and forth with the sublanes (which no longer exist). This now only contains..
I will now be adding in some README stuff |
@KrauseFx I updated the README now. You can view it at https://github.com/joshdholtz/fastlane/blob/before-with-lane/README.md |
Added environments with dotenv
Perfect, thank you so much for this @joshdholtz 🎉 I'll update the README to also have the |
This MIGHT fix #8 in a more manual way
Summary
lane
parameter ontobefore_all
block--env
option onto CLI -fastlane beta --env development
Actions.lane_context[ Actions::SharedValues::ENVIRONMENT ]}
Why
before_all
was jealous thatafter_all
got more informationHow I Use It
I have add "dotenv" into my project with 4 different
.env
files.env
env
contains anything NON specific to my environments.env.development
.env.staging
.env.production
I modified my
Appfile
to use my environment variables so they can be determined by my sublaneExample