From d87bc0b50f6dd4d5b64b924469d45ae40365b82e Mon Sep 17 00:00:00 2001 From: Alexander Annas Helgason Date: Tue, 10 May 2016 17:36:15 +0000 Subject: [PATCH 1/3] Add QuizUp to fastlane examples --- Logos/QuizUp.png | Bin 0 -> 2622 bytes QuizUp/Fastfile | 261 ++++++++++++++++++ QuizUp/README.md | 142 ++++++++++ QuizUp/actions/merge_into_release.rb | 35 +++ QuizUp/actions/prepare_change_log.rb | 86 ++++++ QuizUp/actions/prepare_git_log.rb | 44 +++ QuizUp/actions/prepare_new_version_number.rb | 82 ++++++ .../actions/prepare_release_build_number.rb | 73 +++++ QuizUp/actions/update_translations.rb | 40 +++ QuizUp/actions/upload_to_s3.rb | 32 +++ QuizUp/changelogs/de-DE.txt | 1 + QuizUp/changelogs/en-US.txt | 1 + QuizUp/changelogs/es-ES.txt | 1 + QuizUp/changelogs/es-MX.txt | 1 + QuizUp/changelogs/fr-FR.txt | 1 + QuizUp/changelogs/pt-BR.txt | 1 + README.md | 25 ++ 17 files changed, 826 insertions(+) create mode 100644 Logos/QuizUp.png create mode 100644 QuizUp/Fastfile create mode 100644 QuizUp/README.md create mode 100644 QuizUp/actions/merge_into_release.rb create mode 100644 QuizUp/actions/prepare_change_log.rb create mode 100644 QuizUp/actions/prepare_git_log.rb create mode 100644 QuizUp/actions/prepare_new_version_number.rb create mode 100644 QuizUp/actions/prepare_release_build_number.rb create mode 100644 QuizUp/actions/update_translations.rb create mode 100644 QuizUp/actions/upload_to_s3.rb create mode 100644 QuizUp/changelogs/de-DE.txt create mode 100644 QuizUp/changelogs/en-US.txt create mode 100644 QuizUp/changelogs/es-ES.txt create mode 100644 QuizUp/changelogs/es-MX.txt create mode 100644 QuizUp/changelogs/fr-FR.txt create mode 100644 QuizUp/changelogs/pt-BR.txt diff --git a/Logos/QuizUp.png b/Logos/QuizUp.png new file mode 100644 index 0000000000000000000000000000000000000000..3a88581125c64f84d931bc553c993278095776fb GIT binary patch literal 2622 zcmdT`Yc$l~8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ushes new version number to master" + + lane :bump_version do + ensure_git_status_clean + ensure_git_branch(branch: "master") + + new_version_number = prepare_new_version_number + commit_version_bump(message: "Release v#{new_version_number}", + force:true) + + push_to_git_remote + end + +########################################################################################################## + + desc "Runs tests" + desc "" + desc "- Installs cocoapods" + desc "- Runs tests" + desc "- Cleanup" + lane :test do + scan(device: "iPhone 6s") + + clean_build_artifacts + end + + desc "Runs SwiftLint" + lane :swift_lint do + swiftlint + end + + error do |lane, exception| + slack( + message: exception.message, + success: false + ) + end + +end diff --git a/QuizUp/README.md b/QuizUp/README.md new file mode 100644 index 0000000..a9472e6 --- /dev/null +++ b/QuizUp/README.md @@ -0,0 +1,142 @@ +fastlane documentation +================ +# Installation +``` +sudo gem install fastlane +``` +# Available Actions +## iOS +### ios deploy_daily +``` +fastlane ios deploy_daily +``` +Release a new daily build + + + +- Only works on `master branch` + +- Updates translations + +- Installs cocoapods + +- Signs, builds and uploads `QuizUp Enterprise to Hockey Beta App + +- Sends success message to `#ios-builds` on slack + +- Pushes translations update to master +### ios deploy_hourly +``` +fastlane ios deploy_hourly +``` +Release new hourly build + + + +- Only works on `master` branch + +- Installs cocoapods + +- Prepares and commits a new build number + +- Signs, builds and uploads `Quizup Dogfood Enterprise` target to Hockey Hourly App + +- Sends success message to `#ios-builds` on slack + +- Pushes new version number update to master +### ios upload_beta_to_s3 +``` +fastlane ios upload_beta_to_s3 +``` + +- Only works on `master branch` + +- Installs cocoapods + +- Signs, builds and uploads `QuizUp Enterprise` to the web + +- Sends success message to `#ios-builds` on slack +### ios submit_ipa +``` +fastlane ios submit_ipa +``` +Submits a new build to Apple + + + +Submits the same build to hockey app so beta users will test the same build we are about to ship. + +- Only works on `release` branch + +- Re-installs cocoapods + +- Signs, builds and uploads `QuizUp Enterprise` target to hockey + +- Signs, builds and uploads `Quizup (App Store)` target to app store + +- Uploads `dsysm` of the appstore builds to hockey + +- Notifies `` and `` about new submission + +- Creates and pushes a new tag to github +### ios submit +``` +fastlane ios submit +``` +Submits newest changes to Apple + + + +The designated submission lane + +- Merges new changes from `master` into `release` + +- Prepares a change log + +- Calls `submit_ipa` lane +### ios resubmit +``` +fastlane ios resubmit +``` +Resubmits the the build + + + +- Calls `submit_ipa` lane +### ios bump_version +``` +fastlane ios bump_version +``` +Bumps version numbers + + + +- Only works on `master` branch + +- Create as a new version number e.g. 2.1.8 -> 2.1.9 and 2.1.9 -> 2.2.0 + +- Commits and pushes new version number to master +### ios test +``` +fastlane ios test +``` +Runs tests + + + +- Installs cocoapods + +- Runs tests + +- Cleanup +### ios swift_lint +``` +fastlane ios swift_lint +``` +Runs SwiftLint + +---- + +This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools). +More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane/tree/master/fastlane). \ No newline at end of file diff --git a/QuizUp/actions/merge_into_release.rb b/QuizUp/actions/merge_into_release.rb new file mode 100644 index 0000000..867be7c --- /dev/null +++ b/QuizUp/actions/merge_into_release.rb @@ -0,0 +1,35 @@ +module Fastlane + module Actions + class MergeIntoReleaseAction < Action + def self.run(params) + + command = [ + "git", + "merge", + "origin/master", + ].join(' ') + + Actions.sh command + + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Merge the latest master into release before submitting." + end + + def self.authors + ["hilmarbirgir", "alliannas"] + end + + def self.is_supported?(platform) + platform == :ios + end + + end + end +end + diff --git a/QuizUp/actions/prepare_change_log.rb b/QuizUp/actions/prepare_change_log.rb new file mode 100644 index 0000000..67c7ebb --- /dev/null +++ b/QuizUp/actions/prepare_change_log.rb @@ -0,0 +1,86 @@ +module Fastlane + module Actions + class PrepareChangeLogAction < Action + def self.run(params) + locales = ["de-DE", "en-US", "es-ES", "es-MX", "fr-FR", "pt-BR"] + localesWithMissingChangeLog = [] + + locales.each do |locale| + remainingChangeLogsForLocale = self.check_line_count_for_change_log_file(locale) + if remainingChangeLogsForLocale == 0 + localesWithMissingChangeLog.push(locale) + end + end + + if localesWithMissingChangeLog.empty? == false + missingChangeLogString = localesWithMissingChangeLog.join(', ') + raise "Ran out of localized change logs in %s" % missingChangeLogString + end + + locales.each do |locale| + newChangeLog = self.get_change_log_from_file(locale) + self.set_new_change_log(locale, newChangeLog) + self.remove_change_log_from_file(locale) + end + + begin + Actions.sh("git add -u") + Actions.sh("git commit -m 'Updated changelogs.'") + rescue + # In case there are no changes. + puts("No changes to localized changelogs") + end + + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.check_line_count_for_change_log_file(locale) + file_path = self.change_log_file_path(locale) + line_count = `grep -c '^' "#{file_path}"`.strip.split(' ')[0].to_i + return line_count + end + + def self.get_change_log_from_file(locale) + file_path = self.change_log_file_path(locale) + change_log = File.open(file_path, &:readline) + return change_log + end + + def self.remove_change_log_from_file(locale) + file_path = self.change_log_file_path(locale) + text = '' + File.open(file_path,"r"){|f|f.gets;text=f.read} + File.open(file_path,"w+"){|f| f.write(text)} + end + + def self.set_new_change_log(locale, change_log) + file_path = File.expand_path(File.dirname(__FILE__) + "/../metadata/" + locale + "/release_notes.txt") + File.open(file_path, 'w') { |file| file.write(change_log) } + puts("New change log in %s:" % locale) + puts(change_log) + end + + def self.change_log_file_path(locale) + file_path = File.expand_path(File.dirname(__FILE__) + "/../changelogs/" + locale + ".txt") + return file_path + end + + def self.description + "Set the change log" + end + + def self.authors + ["hilmarbirgir"] + end + + def self.is_supported?(platform) + platform == :ios + end + + end + end +end + diff --git a/QuizUp/actions/prepare_git_log.rb b/QuizUp/actions/prepare_git_log.rb new file mode 100644 index 0000000..91e5af3 --- /dev/null +++ b/QuizUp/actions/prepare_git_log.rb @@ -0,0 +1,44 @@ +module Fastlane + module Actions + module SharedValues + GIT_LOG = :GIT_LOG + end + + class PrepareGitLogAction < Action + def self.run(params) + + command = [ + 'git', + 'log', + '--pretty=format:"%s %n"', + '--since 3-days' + ] + + Actions.lane_context[SharedValues::RELEASE_BUILD_NUMBER] = Actions.sh(command.join(' ')) + end + + def self.description + "Gets the pretty git log for the last 3 days" + end + + def self.available_options + [ + ] + end + + def self.output + [ + ['GIT_LOG', 'The git log for the last 3 days'] + ] + end + + def self.author + "hilmarbirgir" + end + + def self.is_supported?(platform) + true + end + end + end +end \ No newline at end of file diff --git a/QuizUp/actions/prepare_new_version_number.rb b/QuizUp/actions/prepare_new_version_number.rb new file mode 100644 index 0000000..eb7df82 --- /dev/null +++ b/QuizUp/actions/prepare_new_version_number.rb @@ -0,0 +1,82 @@ +module Fastlane + module Actions + module SharedValues + NEW_VERSION = :NEW_VERSION + end + + class PrepareNewVersionNumberAction < Action + def self.run(params) + folder = params[:xcodeproj] ? File.join('.', params[:xcodeproj], '..') : '.' + + command_prefix = [ + 'cd', + File.expand_path(folder).shellescape, + '&&' + ].join(' ') + + current_version = Actions::GetVersionNumberAction.run(xcodeproj: "QuizUp.xcodeproj") + + first_number = Integer(current_version[0]) + second_number = Integer(current_version[2]) + third_number = Integer(current_version[4]) + + if third_number == 9 then + new_version = "%i.%i.%i" % [first_number, second_number + 1, 0] + else + new_version = "%i.%i.%i" % [first_number, second_number, third_number + 1] + end + + new_version_with_build_number = "%s.0" % [new_version] + + Helper.log.info "Changed version number to #{new_version}".green + + command = [ + command_prefix, + "agvtool new-marketing-version #{new_version}" + ].join(' ') + + Actions.sh command + + Actions::IncrementBuildNumberAction.run(build_number: new_version_with_build_number) + + Actions.lane_context[SharedValues::NEW_VERSION] = new_version + end + + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Increment the version number after submitting" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :xcodeproj, + env_name: "FL_PREPARE_NEW_VERSION_PROJECT", + description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory", + optional: true, + verify_block: Proc.new do |value| + raise "Please pass the path to the project, not the workspace".red if value.include?"workspace" + raise "Could not find Xcode project".red if (not File.exists?(value) and not Helper.is_test?) + end) + ] + end + + def self.output + [ + ['NEW_VERSION', 'The new version number'] + ] + end + + def self.authors + ["hilmarbirgir"] + end + + def self.is_supported?(platform) + platform == :ios + end + end + end +end diff --git a/QuizUp/actions/prepare_release_build_number.rb b/QuizUp/actions/prepare_release_build_number.rb new file mode 100644 index 0000000..4341f37 --- /dev/null +++ b/QuizUp/actions/prepare_release_build_number.rb @@ -0,0 +1,73 @@ +module Fastlane + module Actions + module SharedValues + RELEASE_BUILD_NUMBER = :RELEASE_BUILD_NUMBER + end + + class PrepareReleaseBuildNumberAction < Action + def self.run(params) + folder = params[:xcodeproj] ? File.join('.', params[:xcodeproj], '..') : '.' + + command_prefix = [ + 'cd', + File.expand_path(folder).shellescape, + '&&' + ].join(' ') + + timestamp = Time.now.utc + new_build_identifier = "%d%02d%02d%02d%02d" % [ + timestamp.year, + timestamp.month, + timestamp.day, + timestamp.hour, + timestamp.min, + ] + current_version = Actions::GetVersionNumberAction.run(xcodeproj: "QuizUp.xcodeproj") + + new_version = current_version + "." + new_build_identifier + + Helper.log.info "Changed build number to #{new_version}".green + + Actions::IncrementBuildNumberAction.run(build_number: new_version) + + Actions.lane_context[SharedValues::RELEASE_BUILD_NUMBER] = new_version + end + + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Increment the build number by adding a timestamp as the last component" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :xcodeproj, + env_name: "FL_PREPARE_RELEASE_BUILD_NUMBER_PROJECT", + description: "optional, you must specify the path to your main Xcode project if it is not in the project root directory", + optional: true, + verify_block: Proc.new do |value| + raise "Please pass the path to the project, not the workspace".red if value.include?"workspace" + raise "Could not find Xcode project".red if (not File.exists?(value) and not Helper.is_test?) + end) + ] + end + + def self.output + [ + ['RELEASE_BUILD_NUMBER', 'The new build number'] + ] + end + + def self.authors + ["johannth"] + end + + def self.is_supported?(platform) + platform == :ios + end + end + end +end diff --git a/QuizUp/actions/update_translations.rb b/QuizUp/actions/update_translations.rb new file mode 100644 index 0000000..4289280 --- /dev/null +++ b/QuizUp/actions/update_translations.rb @@ -0,0 +1,40 @@ +module Fastlane + module Actions + class UpdateTranslationsAction < Action + def self.run(params) + + command = [ + "uhura pull --yes" + ].join(' ') + + Actions.sh command + + begin + Actions.sh("git add -u") + Actions.sh("git commit -m 'Updated translations'") + rescue + # In case there are no new translations. + end + + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Download the latest translations using uhura" + end + + def self.authors + ["hilmarbirgir"] + end + + def self.is_supported?(platform) + platform == :ios + end + + end + end +end + diff --git a/QuizUp/actions/upload_to_s3.rb b/QuizUp/actions/upload_to_s3.rb new file mode 100644 index 0000000..9cef409 --- /dev/null +++ b/QuizUp/actions/upload_to_s3.rb @@ -0,0 +1,32 @@ +module Fastlane + module Actions + class UploadToS3Action < Action + def self.run(params) + + s3 = Aws::S3::Resource.new + file_path = File.expand_path(File.dirname(__FILE__) + "/../../QuizUp.ipa") + obj = s3.bucket(ENV['SECRET-PROJECT-BUCKET-NAME']).object('QuizUp.ipa') + obj.upload_file(file_path, acl:'public-read') + + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Uploads a build to s3" + end + + def self.authors + ["hilmarbirgir"] + end + + def self.is_supported?(platform) + platform == :ios + end + + end + end +end + diff --git a/QuizUp/changelogs/de-DE.txt b/QuizUp/changelogs/de-DE.txt new file mode 100644 index 0000000..98adb38 --- /dev/null +++ b/QuizUp/changelogs/de-DE.txt @@ -0,0 +1 @@ ++ Insert DE changelogs here 1 per line \ No newline at end of file diff --git a/QuizUp/changelogs/en-US.txt b/QuizUp/changelogs/en-US.txt new file mode 100644 index 0000000..25809c7 --- /dev/null +++ b/QuizUp/changelogs/en-US.txt @@ -0,0 +1 @@ ++ Insert US changelogs here 1 per line \ No newline at end of file diff --git a/QuizUp/changelogs/es-ES.txt b/QuizUp/changelogs/es-ES.txt new file mode 100644 index 0000000..905e59e --- /dev/null +++ b/QuizUp/changelogs/es-ES.txt @@ -0,0 +1 @@ ++ Insert ES changelogs here 1 per line \ No newline at end of file diff --git a/QuizUp/changelogs/es-MX.txt b/QuizUp/changelogs/es-MX.txt new file mode 100644 index 0000000..7b1722e --- /dev/null +++ b/QuizUp/changelogs/es-MX.txt @@ -0,0 +1 @@ ++ Insert MX changelogs here 1 per line \ No newline at end of file diff --git a/QuizUp/changelogs/fr-FR.txt b/QuizUp/changelogs/fr-FR.txt new file mode 100644 index 0000000..edc1a47 --- /dev/null +++ b/QuizUp/changelogs/fr-FR.txt @@ -0,0 +1 @@ ++ Insert FR changelogs here 1 per line \ No newline at end of file diff --git a/QuizUp/changelogs/pt-BR.txt b/QuizUp/changelogs/pt-BR.txt new file mode 100644 index 0000000..0d57d41 --- /dev/null +++ b/QuizUp/changelogs/pt-BR.txt @@ -0,0 +1 @@ ++ Insert BR changelogs here 1 per line \ No newline at end of file diff --git a/README.md b/README.md index 74421d6..a15642b 100644 --- a/README.md +++ b/README.md @@ -267,6 +267,31 @@ A description on how the setup works is available in the [Overview](/Touchwonder

---- +### [QuizUp](https://www.quizup.com) +[![QuizUp](Logos/QuizUp.png)](https://www.quizup.com) + +:rocket: **Advanced - Multiple Environments** + +- Deployment to iTunes Connect +- Deployment to Hockey App +- Running unit tests +- Linting with Swiftlint +- Managing Certificates/Provisioning Profiles +- CI steps as lanes +- Project setup +- Version Bump & Git Actions +- Slack Notifications +- Custom action for internal tranlsation tools +- Custom action for versioning +- Custom action for selecting changelogs + +

+ Overview • + Fastfile +

+---- + + ### [fastlane](https://fastlane.tools) [![fastlane Logo](Logos/fastlane.png)](https://fastlane.tools) From 408e27cbe11fb7c5b56f9f3c5c4256b946fab84e Mon Sep 17 00:00:00 2001 From: Alexander Annas Helgason Date: Thu, 7 Jul 2016 10:36:45 +0000 Subject: [PATCH 2/3] Fixes after review --- QuizUp/Fastfile | 19 +++++-------------- QuizUp/actions/merge_into_release.rb | 2 +- QuizUp/actions/prepare_change_log.rb | 18 +++++++++--------- QuizUp/actions/update_translations.rb | 7 ++++--- QuizUp/actions/upload_to_s3.rb | 20 ++++++++++++++++---- README.md | 2 +- 6 files changed, 36 insertions(+), 32 deletions(-) diff --git a/QuizUp/Fastfile b/QuizUp/Fastfile index ba729ef..b447ff9 100644 --- a/QuizUp/Fastfile +++ b/QuizUp/Fastfile @@ -4,7 +4,7 @@ default_platform :ios platform :ios do -require 'aws-sdk' + require 'aws-sdk' ############################################### Internal Builds ############################################### @@ -41,9 +41,7 @@ require 'aws-sdk' clean_build_artifacts - slack( - message: "Successfully deployed daily." - ) + slack(message: "Successfully deployed daily.") push_to_git_remote end @@ -82,9 +80,7 @@ require 'aws-sdk' clean_build_artifacts - slack( - message: "Successfully deployed hourly." - ) + slack(message: "Successfully deployed hourly.") push_to_git_remote @@ -182,9 +178,7 @@ require 'aws-sdk' channel: ENV["QA_SLACK_CHANNEL"] ) - slack( - message: "Successfully submitted #{release_version_number}." - ) + slack(message: "Successfully submitted #{release_version_number}.") add_git_tag(tag: "v#{release_version_number}") @@ -252,10 +246,7 @@ require 'aws-sdk' end error do |lane, exception| - slack( - message: exception.message, - success: false - ) + slack(message: exception.message, success: false) end end diff --git a/QuizUp/actions/merge_into_release.rb b/QuizUp/actions/merge_into_release.rb index 867be7c..e48ce5b 100644 --- a/QuizUp/actions/merge_into_release.rb +++ b/QuizUp/actions/merge_into_release.rb @@ -26,7 +26,7 @@ def self.authors end def self.is_supported?(platform) - platform == :ios + true end end diff --git a/QuizUp/actions/prepare_change_log.rb b/QuizUp/actions/prepare_change_log.rb index 67c7ebb..ea8a112 100644 --- a/QuizUp/actions/prepare_change_log.rb +++ b/QuizUp/actions/prepare_change_log.rb @@ -12,9 +12,9 @@ def self.run(params) end end - if localesWithMissingChangeLog.empty? == false - missingChangeLogString = localesWithMissingChangeLog.join(', ') - raise "Ran out of localized change logs in %s" % missingChangeLogString + unless localesWithMissingChangeLog.empty? + missingChangeLogString = localesWithMissingChangeLog.join(', ') + UI.user_error!("Ran out of localized change logs in {#missingChangeLogString}") end locales.each do |locale| @@ -26,10 +26,10 @@ def self.run(params) begin Actions.sh("git add -u") Actions.sh("git commit -m 'Updated changelogs.'") - rescue - # In case there are no changes. - puts("No changes to localized changelogs") - end + rescue + # In case there are no changes. + UI.message "No changes to localized changelogs" + end end @@ -52,8 +52,8 @@ def self.get_change_log_from_file(locale) def self.remove_change_log_from_file(locale) file_path = self.change_log_file_path(locale) text = '' - File.open(file_path,"r"){|f|f.gets;text=f.read} - File.open(file_path,"w+"){|f| f.write(text)} + File.open(file_path, "r") { |f| f.gets; text = f.read } + File.open(file_path, "w+") { |f| f.write(text) } end def self.set_new_change_log(locale, change_log) diff --git a/QuizUp/actions/update_translations.rb b/QuizUp/actions/update_translations.rb index 4289280..f17b1cc 100644 --- a/QuizUp/actions/update_translations.rb +++ b/QuizUp/actions/update_translations.rb @@ -12,11 +12,10 @@ def self.run(params) begin Actions.sh("git add -u") Actions.sh("git commit -m 'Updated translations'") - rescue + rescue # In case there are no new translations. - end - end + end ##################################################### # @!group Documentation @@ -24,6 +23,8 @@ def self.run(params) def self.description "Download the latest translations using uhura" + "uhura is an internal QuizUp python tool we use to download and install" + "translations from OneSky" end def self.authors diff --git a/QuizUp/actions/upload_to_s3.rb b/QuizUp/actions/upload_to_s3.rb index 9cef409..428fa49 100644 --- a/QuizUp/actions/upload_to_s3.rb +++ b/QuizUp/actions/upload_to_s3.rb @@ -1,13 +1,12 @@ module Fastlane module Actions class UploadToS3Action < Action - def self.run(params) + def self.run(options) s3 = Aws::S3::Resource.new - file_path = File.expand_path(File.dirname(__FILE__) + "/../../QuizUp.ipa") - obj = s3.bucket(ENV['SECRET-PROJECT-BUCKET-NAME']).object('QuizUp.ipa') + file_path = options[:ipa] + obj = s3.bucket(ENV['SECRET-PROJECT-BUCKET-NAME']).object(File.basename(file_path)) obj.upload_file(file_path, acl:'public-read') - end ##################################################### @@ -22,6 +21,19 @@ def self.authors ["hilmarbirgir"] end + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: ipa, + env_name: "S3_IPA_FILE_PATH", + description: "Path to the IPA file to upload", + default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH], + optional: true, + verify_block: proc do |value| + UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value) + end) + ] + end + def self.is_supported?(platform) platform == :ios end diff --git a/README.md b/README.md index a15642b..9634fb0 100644 --- a/README.md +++ b/README.md @@ -270,7 +270,7 @@ A description on how the setup works is available in the [Overview](/Touchwonder ### [QuizUp](https://www.quizup.com) [![QuizUp](Logos/QuizUp.png)](https://www.quizup.com) -:rocket: **Advanced - Multiple Environments** +:zap: **Advanced - Multiple Environments** - Deployment to iTunes Connect - Deployment to Hockey App From c673d20e6944b9fa694ee43c47c73eb0e9af803c Mon Sep 17 00:00:00 2001 From: Alexander Annas Helgason Date: Thu, 15 Sep 2016 21:42:40 +0000 Subject: [PATCH 3/3] Adds options for project_bucket_name for action upload_to_s3 --- QuizUp/actions/upload_to_s3.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/QuizUp/actions/upload_to_s3.rb b/QuizUp/actions/upload_to_s3.rb index 428fa49..de871a8 100644 --- a/QuizUp/actions/upload_to_s3.rb +++ b/QuizUp/actions/upload_to_s3.rb @@ -5,7 +5,7 @@ def self.run(options) s3 = Aws::S3::Resource.new file_path = options[:ipa] - obj = s3.bucket(ENV['SECRET-PROJECT-BUCKET-NAME']).object(File.basename(file_path)) + obj = s3.bucket(options[:project_bucket-name]).object(File.basename(file_path)) obj.upload_file(file_path, acl:'public-read') end @@ -30,7 +30,12 @@ def self.available_options optional: true, verify_block: proc do |value| UI.user_error!("Couldn't find ipa file at path '#{value}'") unless File.exist?(value) - end) + end), + FastlaneCore::ConfigItem.new(key: project_bucket_name, + env_name: "S3_PROJECT_BUCKET_NAME", + description: "S3 project bucket name", + type: String, + optional: false) ] end