Skip to content

Commit

Permalink
Update fastlane to prevent crashes when releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
mac-cain13 committed Jun 23, 2018
1 parent 16954a2 commit 3110c46
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ lane :release do |options|
ensure_git_branch(branch: "master")
ensure_git_status_clean
else
Helper.log.info "Skipping the 'git status clean' and branch check!".yellow
UI.message "Skipping the 'git status clean' and branch check!".yellow
end

git_pull
Expand All @@ -16,7 +16,7 @@ lane :release do |options|
end

currentVersion = version_get_podspec()
Helper.log.info "Current R.swift podspec version is #{currentVersion}"
UI.message "Current R.swift podspec version is #{currentVersion}"

isPrerelease = false
bumpType = prompt(text: "What kind of release is this? (major/minor/patch/custom)".green, boolean: false, ci_input: "")
Expand Down Expand Up @@ -50,7 +50,7 @@ lane :release do |options|
if options[:skip_tests] != true
runalltests
else
Helper.log.info "Skipping tests!".yellow
UI.message "Skipping tests!".yellow
end

sh "cd .. && swift build -c release -Xswiftc -static-stdlib"
Expand Down
8 changes: 4 additions & 4 deletions fastlane/actions/af_create_github_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@ def self.run(params)
# Fetch Request
res = http.request(req)
rescue StandardError => e
Helper.log.info "HTTP Request failed (#{e.message})".red
UI.message "HTTP Request failed (#{e.message})".red
end

case res.code.to_i
when 201
json = JSON.parse(res.body)
Helper.log.info "Github Release Created (#{json["id"]})".green
Helper.log.info "#{json["html_url"]}".green
UI.message "Github Release Created (#{json["id"]})".green
UI.message "#{json["html_url"]}".green

Actions.lane_context[SharedValues::GITHUB_RELEASE_ID] = json["id"]
Actions.lane_context[SharedValues::GITHUB_RELEASE_HTML_URL] = json["html_url"]
Expand All @@ -69,7 +69,7 @@ def self.run(params)
json = JSON.parse(res.body)
raise "Error Creating Github Release (#{res.code}): #{json}".red
else
Helper.log.info "Status Code: #{res.code} Body: #{res.body}"
UI.message "Status Code: #{res.code} Body: #{res.body}"
raise "Error Creating Github Release".red
end
end
Expand Down
2 changes: 1 addition & 1 deletion fastlane/actions/af_insert_text_into_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def self.run(params)
open(params[:file_path], 'w') { |f| f << params[:text] << file}
end

Helper.log.info "#{params[:file_path]} has been updated".green
UI.message "#{params[:file_path]} has been updated".green
end

#####################################################
Expand Down
6 changes: 3 additions & 3 deletions fastlane/actions/af_upload_asset_for_github_release.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ def self.run(params)
# Fetch Request
res = http.request(req)
rescue StandardError => e
Helper.log.info "HTTP Request failed (#{e.message})".red
UI.message "HTTP Request failed (#{e.message})".red
end

case res.code.to_i
when 201
json = JSON.parse(res.body)
Helper.log.info "#{json["name"]} has been uploaded to the release".green
UI.message "#{json["name"]} has been uploaded to the release".green
Actions.lane_context[SharedValues::GITHUB_UPLOAD_ASSET_URL] = json["browser_download_url"]
return json
when 400..499
json = JSON.parse(res.body)
raise "Error Creating Github Release (#{res.code}): #{json}".red
else
Helper.log.info "Status Code: #{res.code} Body: #{res.body}"
UI.message "Status Code: #{res.code} Body: #{res.body}"
raise "Error Creating Github Release".red
end
end
Expand Down

0 comments on commit 3110c46

Please sign in to comment.