{"action":"created","issue":{"url":"https://api.github.com/repos/KrauseFx/fastlane/issues/581","labels_url":"https://api.github.com/repos/KrauseFx/fastlane/issues/581/labels{/name}","comments_url":"https://api.github.com/repos/KrauseFx/fastlane/issues/581/comments","events_url":"https://api.github.com/repos/KrauseFx/fastlane/issues/581/events","html_url":"https://github.com/KrauseFx/fastlane/issues/581","id":105259029,"number":581,"title":"Upload increment_build_number or increment_version_number programatically","user":{"login":"mchiesa","id":1329332,"avatar_url":"https://avatars.githubusercontent.com/u/1329332?v=3","gravatar_id":"","url":"https://api.github.com/users/mchiesa","html_url":"https://github.com/mchiesa","followers_url":"https://api.github.com/users/mchiesa/followers","following_url":"https://api.github.com/users/mchiesa/following{/other_user}","gists_url":"https://api.github.com/users/mchiesa/gists{/gist_id}","starred_url":"https://api.github.com/users/mchiesa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mchiesa/subscriptions","organizations_url":"https://api.github.com/users/mchiesa/orgs","repos_url":"https://api.github.com/users/mchiesa/repos","events_url":"https://api.github.com/users/mchiesa/events{/privacy}","received_events_url":"https://api.github.com/users/mchiesa/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-09-07T19:12:12Z","updated_at":"2015-09-08T13:38:56Z","closed_at":null,"body":"Hi KrauseFx, I want to update build number or version number depending a boolean value\r\n\r\nHere is my fastlane file :\r\n\r\n```ruby\r\nplatform :ios do\r\n\r\n  before_all do\r\n    # ENV[\"SLACK_URL\"] = \"https://hooks.slack.com/services/...\"\r\n\r\n    # cocoapods\r\n    gym # Build your app - more options available\r\n\r\n    # xctool # run the tests of your app\r\n  end\r\n\r\n  private_lane :build_app do |options|\r\n    if options[:increment_build_number]\r\n      increment_build_number\r\n    end\r\n\r\n    if options[:increment_version_number]\r\n      increment_version_number\r\n    end\r\n  end\r\n\r\n  desc \"Runs all the tests\"\r\n  lane :test do\r\n    #snapshot\r\n  end\r\n\r\n  desc \"Submit a new Beta Build to Apple TestFlight\"\r\n  desc \"This will also make sure the profile is up to date\"\r\n  lane :beta do |options|\r\n    #snapshot\r\n    build_app\r\n    sigh\r\n\r\n    if options[:upload_to_testflight]\r\n      deliver(beta: true)\r\n    end\r\n   \r\n   if options[:upload_to_crashlytics]\r\n       crashlytics({\r\n         crashlytics_path:'./Crashlytics.framework',\r\n         api_token: '5895XXXXXXXXXXXXX872XXX',\r\n         build_secret: 'XXXXXXX',\r\n         ipa_path: 'Test.ipa'\r\n      })\r\n   end\r\nend\r\n```\r\n\r\nEverything works fine, but build/version number is not updating.. What is wrong?\r\n\r\nThanks a lot,\r\nMartin"},"comment":{"url":"https://api.github.com/repos/KrauseFx/fastlane/issues/comments/138561225","html_url":"https://github.com/KrauseFx/fastlane/issues/581#issuecomment-138561225","issue_url":"https://api.github.com/repos/KrauseFx/fastlane/issues/581","id":138561225,"user":{"login":"mdeandreis","id":14180110,"avatar_url":"https://avatars.githubusercontent.com/u/14180110?v=3","gravatar_id":"","url":"https://api.github.com/users/mdeandreis","html_url":"https://github.com/mdeandreis","followers_url":"https://api.github.com/users/mdeandreis/followers","following_url":"https://api.github.com/users/mdeandreis/following{/other_user}","gists_url":"https://api.github.com/users/mdeandreis/gists{/gist_id}","starred_url":"https://api.github.com/users/mdeandreis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdeandreis/subscriptions","organizations_url":"https://api.github.com/users/mdeandreis/orgs","repos_url":"https://api.github.com/users/mdeandreis/repos","events_url":"https://api.github.com/users/mdeandreis/events{/privacy}","received_events_url":"https://api.github.com/users/mdeandreis/received_events","type":"User","site_admin":false},"created_at":"2015-09-08T13:38:56Z","updated_at":"2015-09-08T13:38:56Z","body":"Hi KrauseFx, it´s me again\r\n\r\nI´m triying to update build number or version number depending a boolean value using fastlane\r\n\r\nIf I do this I can´t achieve what I want\r\n\r\nbefore_all do\r\n    # ENV[\"SLACK_URL\"] = \"https://hooks.slack.com/services/...\"\r\n\r\n    # cocoapods\r\n    gym # Build your app - more options available\r\n    # xctool # run the tests of your app\r\n  end\r\n\r\n  private_lane :build_app do |options|\r\n    if options[:increment_build_number]\r\n      increment_build_number\r\n    end\r\n\r\n    if options[:increment_version_number]\r\n      increment_version_number\r\n    end\r\n  end\r\n\r\n  desc \"Submit a new Beta Build to Apple TestFlight\"\r\n  desc \"This will also make sure the profile is up to date\"\r\n  lane :beta do |options|\r\n    #snapshot\r\n    echo\r\n    build_app(options)\r\n    sigh\r\n\r\n    if options[:upload_to_testflight]\r\n      deliver(beta: true)\r\n    end\r\n   \r\n   if options[:upload_to_crashlytics]\r\n       crashlytics({\r\n         crashlytics_path:'./Crashlytics.framework',\r\n         api_token: 'XXX5XXx',\r\n         build_secret: 'XXXX0d6667166cXX',\r\n         ipa_path: 'Test.ipa'\r\n      })\r\n   end\r\n   \r\n    # sh \"your_script.sh\"\r\n    # You can also use other beta testing services here\r\n  end\r\nend\r\n\r\nOn the other hand, If I change my code and do this I update version/build number. I want to update version/build number only if the increment_version_number parameter is true. Besides, in before_all section I can´t access to options. How can I achieve what I want? \r\n\r\nbefore_all do\r\n    # ENV[\"SLACK_URL\"] = \"https://hooks.slack.com/services/...\"\r\n\r\n    # cocoapods\r\n    gym # Build your app - more options available\r\n    # xctool # run the tests of your app\r\n   increment_version_number\r\n  end\r\n\r\n  desc \"Submit a new Beta Build to Apple TestFlight\"\r\n  desc \"This will also make sure the profile is up to date\"\r\n  lane :beta do |options|\r\n    #snapshot\r\n    echo\r\n    build_app(options)\r\n    sigh\r\n\r\n    if options[:upload_to_testflight]\r\n      deliver(beta: true)\r\n    end\r\n   \r\n   if options[:upload_to_crashlytics]\r\n       crashlytics({\r\n         crashlytics_path:'./Crashlytics.framework',\r\n         api_token: 'XXX5XXx',\r\n         build_secret: 'XXXX0d6667166cXX',\r\n         ipa_path: 'Test.ipa'\r\n      })\r\n   end\r\n   \r\n    # sh \"your_script.sh\"\r\n    # You can also use other beta testing services here\r\n  end\r\nend\r\n\r\nThanks, Martin"}}