Skip to content

Commit

Permalink
Merge pull request #25 from joshdholtz/skip-html-upload-and-zip-fixes
Browse files Browse the repository at this point in the history
Can skip HTML upload and zip source fixes
  • Loading branch information
Josh Holtz authored May 19, 2017
2 parents 61e521c + 4c7e645 commit b2bfddb
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 15 deletions.
7 changes: 5 additions & 2 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ lane :ipa21 do
aws_s3(
bucket: 'fastlane-plugin-s3-ios',
region: 'us-west-1',
ipa: './fastlane/ipa21/BanditTheCat.ipa'
ipa: './fastlane/ipa21/BanditTheCat.ipa',
source: './fastlane/ipa21/source',
skip_html_upload: true
)
end

Expand All @@ -38,7 +40,8 @@ lane :apk1 do
bucket: 'fastlane-plugin-s3-android',
region: 'us-west-1',
apk: './fastlane/apk1/BanditTheCat.apk',
source: './fastlane/apk1/source'
source: './fastlane/apk1/source',
skip_html_upload: true
)
end

Expand Down
3 changes: 3 additions & 0 deletions fastlane/ipa21/source/Something.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#
# Header stuff
#
1 change: 1 addition & 0 deletions fastlane/ipa21/source/Something2.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
print("Heyyyyy")
36 changes: 24 additions & 12 deletions lib/fastlane/plugin/aws_s3/actions/aws_s3_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def self.run(config)
params[:plist_file_name] = config[:plist_file_name]
params[:html_template_path] = config[:html_template_path]
params[:html_file_name] = config[:html_file_name]
params[:skip_html_upload] = config[:skip_html_upload]
params[:version_template_path] = config[:version_template_path]
params[:version_file_name] = config[:version_file_name]

Expand Down Expand Up @@ -145,10 +146,8 @@ def self.upload_ipa(s3_client, params, s3_region, s3_access_key, s3_secret_acces

# Creates plist from template
if plist_template_path && File.exist?(plist_template_path)
puts "1 - #{plist_template_path}"
plist_template = eth.load_from_path(plist_template_path)
else
puts "2 - #{Helper.gem_path('fastlane-plugin-aws_s3')}"
plist_template = eth.load("s3_ios_plist_template")
end
plist_render = eth.render(plist_template, {
Expand Down Expand Up @@ -203,21 +202,26 @@ def self.upload_ipa(s3_client, params, s3_region, s3_access_key, s3_secret_acces
# html uploading
#
#####################################
html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl)

skip_html = params[:skip_html_upload]

html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl) unless skip_html
version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl)

# Setting action and environment variables
Actions.lane_context[SharedValues::S3_PLIST_OUTPUT_PATH] = plist_url
ENV[SharedValues::S3_PLIST_OUTPUT_PATH.to_s] = plist_url

Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url
ENV[SharedValues::S3_HTML_OUTPUT_PATH.to_s] = html_url
Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url unless skip_html
ENV[SharedValues::S3_HTML_OUTPUT_PATH.to_s] = html_url unless skip_html

Actions.lane_context[SharedValues::S3_VERSION_OUTPUT_PATH] = version_url
ENV[SharedValues::S3_VERSION_OUTPUT_PATH.to_s] = version_url

self.upload_source(s3_client, params, s3_bucket, params[:source], s3_path, acl)

UI.success("Successfully uploaded ipa file to '#{Actions.lane_context[SharedValues::S3_IPA_OUTPUT_PATH]}'")
UI.success("iOS app can be downloaded at '#{Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}'")
UI.success("iOS app can be downloaded at '#{Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}'") unless skip_html
end

def self.upload_apk(s3_client, params, s3_region, s3_access_key, s3_secret_access_key, s3_bucket, apk_file, s3_path, acl)
Expand Down Expand Up @@ -296,20 +300,22 @@ def self.upload_apk(s3_client, params, s3_region, s3_access_key, s3_secret_acces
# html and plist uploading
#
#####################################

skip_html = params[:skip_html_upload]

html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl)
html_url = self.upload_file(s3_client, s3_bucket, app_directory, html_file_name, html_render, acl) unless skip_html
version_url = self.upload_file(s3_client, s3_bucket, app_directory, version_file_name, version_render, acl)

Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url
ENV[SharedValues::S3_HTML_OUTPUT_PATH.to_s] = html_url
Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH] = html_url unless skip_html
ENV[SharedValues::S3_HTML_OUTPUT_PATH.to_s] = html_url unless skip_html

Actions.lane_context[SharedValues::S3_VERSION_OUTPUT_PATH] = version_url
ENV[SharedValues::S3_VERSION_OUTPUT_PATH.to_s] = version_url

UI.success("Successfully uploaded apk file to '#{Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH]}'")
UI.success("Android app can be downloaded at '#{Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}'")

self.upload_source(s3_client, params, s3_bucket, params[:source], s3_path, acl)

UI.success("Successfully uploaded apk file to '#{Actions.lane_context[SharedValues::S3_APK_OUTPUT_PATH]}'")
UI.success("Android app can be downloaded at '#{Actions.lane_context[SharedValues::S3_HTML_OUTPUT_PATH]}'") unless skip_html
end

def self.upload_source(s3_client, params, s3_bucket, source_directory, s3_path, acl)
Expand Down Expand Up @@ -466,6 +472,12 @@ def self.available_options
env_name: "",
description: "uploaded html filename",
optional: true),
FastlaneCore::ConfigItem.new(key: :skip_html_upload,
env_name: "",
description: "skip html upload if true",
optional: true,
default_value: false,
is_string: false),
FastlaneCore::ConfigItem.new(key: :version_template_path,
env_name: "",
description: "version erb template path",
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/aws_s3/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module AwsS3
VERSION = "0.2.6"
VERSION = "0.2.7"
end
end

0 comments on commit b2bfddb

Please sign in to comment.