fastlane-plugin-upload_to_s3 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6f99f9b0b1ecc840a464b45181845e3b8407af02c137471066aafbf5414ee89c
4
+ data.tar.gz: 116b77af20757e21efc4f02d6c9d28f517660bb77b20fb8742bff16c110082f5
5
+ SHA512:
6
+ metadata.gz: 2e0a3c11f28bc83abdcc268d048df8eaa81f1ca5db06ac4545aa94267b272b667afa82bd392d3713f38107550fe25b46f7bad86bec1dffc2aa9f3aa5985fbdd2
7
+ data.tar.gz: 0b36dbbc33ee120f7e8f836d273bb75b8b6fd74e231ebc899d8c3b0d87c782f17975825465c92c35ac97aceed619f09cb38ff372e861b94b6dc6bce983cb1def
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 ov3rk1ll <overkillerror@gmail.com>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # upload_to_s3 plugin
2
+
3
+ [![fastlane Plugin Badge](https://rawcdn.githack.com/fastlane/fastlane/master/fastlane/assets/plugin-badge.svg)](https://rubygems.org/gems/fastlane-plugin-upload_to_s3)
4
+
5
+ ## Getting Started
6
+
7
+ This project is a [_fastlane_](https://github.com/fastlane/fastlane) plugin. To get started with `fastlane-plugin-upload_to_s3`, add it to your project by running:
8
+
9
+ ```bash
10
+ fastlane add_plugin upload_to_s3
11
+ ```
12
+
13
+ ## About upload_to_s3
14
+
15
+ Upload any file to S3 or a S3-compatible host
16
+
17
+ **Note to author:** Add a more detailed description about this plugin here. If your plugin contains multiple actions, make sure to mention them here.
18
+
19
+ ## Example
20
+
21
+ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `fastlane install_plugins` and `bundle exec fastlane test`.
22
+
23
+ **Note to author:** Please set up a sample project to make it easy for users to explore what your plugin does. Provide everything that is necessary to try out the plugin in this project (including a sample Xcode/Android project if necessary)
24
+
25
+ ## Run tests for this plugin
26
+
27
+ To run both the tests, and code style validation, run
28
+
29
+ ```
30
+ rake
31
+ ```
32
+
33
+ To automatically fix many of the styling issues, use
34
+ ```
35
+ rubocop -a
36
+ ```
37
+
38
+ ## Issues and Feedback
39
+
40
+ For any other issues and feedback about this plugin, please submit it to this repository.
41
+
42
+ ## Troubleshooting
43
+
44
+ If you have trouble using plugins, check out the [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
45
+
46
+ ## Using _fastlane_ Plugins
47
+
48
+ For more information about how the `fastlane` plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
49
+
50
+ ## About _fastlane_
51
+
52
+ _fastlane_ is the easiest way to automate beta deployments and releases for your iOS and Android apps. To learn more, check out [fastlane.tools](https://fastlane.tools).
@@ -0,0 +1,173 @@
1
+ module Fastlane
2
+ module Actions
3
+ module SharedValues
4
+ S3_FILE_OUTPUT_PATH = :S3_FILE_OUTPUT_PATH
5
+ end
6
+
7
+ # To share this integration with the other fastlane users:
8
+ # - Fork https://github.com/KrauseFx/fastlane
9
+ # - Clone the forked repository
10
+ # - Move this integration into lib/fastlane/actions
11
+ # - Commit, push and submit the pull request
12
+
13
+ class UploadToS3Action < Action
14
+ def self.add_slash(str)
15
+ safe_str = str || ""
16
+ safe_str.empty? ? "" : "#{safe_str}/"
17
+ end
18
+
19
+ def self.run(params)
20
+ # fastlane will take care of reading in the parameter and fetching the environment variable:
21
+ UI.verbose("Key: #{params[:key]}")
22
+ UI.verbose("File: #{params[:file]}")
23
+ UI.verbose("Bucket: #{params[:bucket]}")
24
+ UI.verbose("ACL: #{params[:acl]}")
25
+
26
+ # Pulling parameters for other uses
27
+ s3_endpoint = params[:endpoint]
28
+ s3_region = params[:region]
29
+ # s3_subdomain = params[:region] ? "s3-#{params[:region]}" : "s3"
30
+ s3_access_key = params[:access_key]
31
+ s3_secret_access_key = params[:secret_access_key]
32
+ s3_bucket = params[:bucket]
33
+ s3_key = params[:key]
34
+ s3_body = params[:file]
35
+ s3_acl = params[:acl]
36
+
37
+ Actions.verify_gem!("aws-sdk")
38
+ require "aws-sdk"
39
+
40
+ if s3_endpoint
41
+ UI.verbose("S3-Client with endpoint: #{s3_endpoint}")
42
+ s3_client = Aws::S3::Client.new(
43
+ access_key_id: s3_access_key,
44
+ secret_access_key: s3_secret_access_key,
45
+ endpoint: s3_endpoint,
46
+ region: "us-east-1"
47
+ )
48
+ elsif s3_region
49
+ UI.verbose("S3-Client with region: #{s3_region}")
50
+ s3_client = Aws::S3::Client.new(
51
+ access_key_id: s3_access_key,
52
+ secret_access_key: s3_secret_access_key,
53
+ region: s3_region
54
+ )
55
+ else
56
+ UI.verbose("S3-Client with default region")
57
+ s3_client = Aws::S3::Client.new(
58
+ access_key_id: s3_access_key,
59
+ secret_access_key: s3_secret_access_key
60
+ )
61
+ end
62
+
63
+ File.open(s3_body, "r") do |file|
64
+ s3_client.put_object(
65
+ acl: s3_acl,
66
+ bucket: s3_bucket,
67
+ key: s3_key,
68
+ body: file
69
+ )
70
+ end
71
+
72
+ UI.verbose("uploaded: #{s3_body} to #{s3_bucket}/#{s3_key}")
73
+
74
+ final_url = add_slash(params[:bucket_url])
75
+ if final_url.empty?
76
+ final_url = "#{s3_bucket}/"
77
+ end
78
+
79
+ final_url = "#{final_url}#{s3_key}"
80
+
81
+ Actions.lane_context[SharedValues::S3_FILE_OUTPUT_PATH] = final_url
82
+ end
83
+
84
+ #####################################################
85
+ # @!group Documentation
86
+ #####################################################
87
+
88
+ def self.description
89
+ "Uploads a binary file to s3."
90
+ end
91
+
92
+ def self.available_options
93
+ # Define all options your action supports.
94
+
95
+ # Below a few examples
96
+ [
97
+ FastlaneCore::ConfigItem.new(key: :bucket_url,
98
+ env_name: "S3_BUCKET_URL",
99
+ description: "Endpoint for S3",
100
+ is_string: true, # true: verifies the input is a string, false: every kind of value
101
+ optional: true), # the default value if the user didn't provide one
102
+ FastlaneCore::ConfigItem.new(key: :endpoint,
103
+ env_name: "S3_ENDPOINT",
104
+ description: "Endpoint for S3",
105
+ is_string: true, # true: verifies the input is a string, false: every kind of value
106
+ optional: true), # the default value if the user didn't provide one
107
+ FastlaneCore::ConfigItem.new(key: :region,
108
+ env_name: "S3_REGION",
109
+ description: "Region for S3",
110
+ is_string: true, # true: verifies the input is a string, false: every kind of value
111
+ optional: true), # the default value if the user didn't provide one
112
+ FastlaneCore::ConfigItem.new(key: :access_key,
113
+ env_name: "S3_ACCESS_KEY", # The name of the environment variable
114
+ description: "Access Key for S3", # a short description of this parameter
115
+ verify_block: proc do |value|
116
+ raise "No Access key for UploadToS3Action given, pass using `access_key: 'access_key'`".red unless value && !value.empty?
117
+ end,
118
+ is_string: true),
119
+ FastlaneCore::ConfigItem.new(key: :secret_access_key,
120
+ env_name: "S3_SECRET_ACCESS_KEY", # The name of the environment variable
121
+ description: "Secret Access for S3", # a short description of this parameter
122
+ verify_block: proc do |value|
123
+ raise "No Secret Access for UploadToS3Action given, pass using `secret_access_key: 'secret_access_key'`".red unless value && !value.empty?
124
+ end,
125
+ is_string: true),
126
+ FastlaneCore::ConfigItem.new(key: :bucket,
127
+ env_name: "S3_BUCKET", # The name of the environment variable
128
+ description: "Bucket for S3", # a short description of this parameter
129
+ verify_block: proc do |value|
130
+ raise "No Bucket for UploadToS3Action given, pass using `bucket: 'bucket'`".red unless value && !value.empty?
131
+ end,
132
+ is_string: true),
133
+ FastlaneCore::ConfigItem.new(key: :key,
134
+ env_name: "",
135
+ description: "Key to s3 bucket",
136
+ is_string: false, # true: verifies the input is a string, false: every kind of value
137
+ default_value: false), # the default value if the user didn't provide one
138
+ FastlaneCore::ConfigItem.new(key: :acl,
139
+ env_name: "",
140
+ description: "Access level for the file",
141
+ is_string: true, # true: verifies the input is a string, false: every kind of value
142
+ default_value: "private"),
143
+ FastlaneCore::ConfigItem.new(key: :file,
144
+ env_name: "", # The name of the environment variable
145
+ description: "File to be uploaded for S3", # a short description of this parameter
146
+ verify_block: proc do |value|
147
+ raise "Couldn't find file at path '#{value}'".red unless File.exist?(value)
148
+ end)
149
+ ]
150
+ end
151
+
152
+ def self.output
153
+ # Define the shared values you are going to provide
154
+ # Example
155
+ [
156
+ ["S3_FILE_OUTPUT_PATH", "URL of the uploaded file."]
157
+ ]
158
+ end
159
+
160
+ def self.return_value
161
+ # If you method provides a return value, you can describe here what it does
162
+ end
163
+
164
+ def self.authors
165
+ ["ov3rk1ll"]
166
+ end
167
+
168
+ def self.is_supported?(platform)
169
+ true
170
+ end
171
+ end
172
+ end
173
+ end
@@ -0,0 +1,16 @@
1
+ require "fastlane_core/ui/ui"
2
+
3
+ module Fastlane
4
+ UI = FastlaneCore::UI unless Fastlane.const_defined?(:UI)
5
+
6
+ module Helper
7
+ class UploadToS3Helper
8
+ # class methods that you define here become available in your action
9
+ # as `Helper::UploadToS3Helper.your_method`
10
+ #
11
+ def self.show_message
12
+ UI.message("Hello from the upload_to_s3 plugin helper!")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ module Fastlane
2
+ module UploadToS3
3
+ VERSION = "0.1.3"
4
+ end
5
+ end
@@ -0,0 +1,16 @@
1
+ require "fastlane/plugin/upload_to_s3/version"
2
+
3
+ module Fastlane
4
+ module UploadToS3
5
+ # Return all .rb files inside the "actions" and "helper" directory
6
+ def self.all_classes
7
+ Dir[File.expand_path("**/{actions,helper}/*.rb", File.dirname(__FILE__))]
8
+ end
9
+ end
10
+ end
11
+
12
+ # By default we want to import all available actions and helpers
13
+ # A plugin can contain any number of actions and plugins
14
+ Fastlane::UploadToS3.all_classes.each do |current|
15
+ require current
16
+ end
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: fastlane-plugin-upload_to_s3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ platform: ruby
6
+ authors:
7
+ - ov3rk1ll
8
+ bindir: bin
9
+ cert_chain: []
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: aws-sdk
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '3.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '3.0'
26
+ email: overkillerror@gmail.com
27
+ executables: []
28
+ extensions: []
29
+ extra_rdoc_files: []
30
+ files:
31
+ - LICENSE
32
+ - README.md
33
+ - lib/fastlane/plugin/upload_to_s3.rb
34
+ - lib/fastlane/plugin/upload_to_s3/actions/upload_to_s3_action.rb
35
+ - lib/fastlane/plugin/upload_to_s3/helper/upload_to_s3_helper.rb
36
+ - lib/fastlane/plugin/upload_to_s3/version.rb
37
+ licenses:
38
+ - MIT
39
+ metadata:
40
+ rubygems_mfa_required: 'true'
41
+ rdoc_options: []
42
+ require_paths:
43
+ - lib
44
+ required_ruby_version: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '2.6'
49
+ required_rubygems_version: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ requirements: []
55
+ rubygems_version: 3.6.9
56
+ specification_version: 4
57
+ summary: Upload any file to S3 or a S3-compatible host
58
+ test_files: []