fastlane-plugin-notarize 0.1.0
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 +7 -0
- data/LICENSE +21 -0
- data/README.md +50 -0
- data/lib/fastlane/plugin/notarize.rb +13 -0
- data/lib/fastlane/plugin/notarize/actions/notarize_action.rb +132 -0
- data/lib/fastlane/plugin/notarize/version.rb +5 -0
- metadata +160 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a4ed3b8ac3d78250058bfede6901efca6737e756
|
4
|
+
data.tar.gz: 559bbd32554af05a591c42478013fd751882d2d0
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d1052f35aa220439d85a292f7b8272652d8af0e6fbc6e5f84dd2154af80c323fbde49b5115b9af7fdd2b9b61a7d95d622274011443d53e9d87a3244fe35e0587
|
7
|
+
data.tar.gz: 3c59545938745b0fa78257c4fb647991f465f1e3ae99c4add2b236d223af853dc1f9dc9724ed8644441714d24d79a11ee3ea32cd9cfc24fee2bfd5cd2e537ef1
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Zeplin, Inc.
|
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,50 @@
|
|
1
|
+
# fastlane notarize plugin [](https://rubygems.org/gems/fastlane-plugin-notarize)
|
2
|
+
|
3
|
+
[fastlane](https://github.com/fastlane/fastlane) plugin to [notarize](https://developer.apple.com/documentation/security/notarizing_your_app_before_distribution) a macOS app.
|
4
|
+
|
5
|
+
Notarize plugin provides a `notarize` action to upload an app to Apple's notarization service, querying the result periodically until it's complete—which currently takes around 2 minutes. In case of success, it staples the app with the notarization ticket. In case of failure, it prints the log file listing all the issues.
|
6
|
+
|
7
|
+
## Getting started
|
8
|
+
|
9
|
+
To get started, add it to your project:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
fastlane add_plugin notarize
|
13
|
+
```
|
14
|
+
|
15
|
+
Update your `Fastfile` to use the `notarize` action:
|
16
|
+
```ruby
|
17
|
+
notarize(
|
18
|
+
package: app_path, # Path to package to notarize, e.g. .app bundle or disk image
|
19
|
+
bundle_id: bundle_id # Not required for .app bundles, bundle identifier to uniquely identify the package.
|
20
|
+
)
|
21
|
+
```
|
22
|
+
|
23
|
+
This action should prompt you for an Apple ID and password, using fastlane's built-in credentials manager. To use the action in a CI environment like Travis CI, CircleCI or Bitrise, you can set `FASTLANE_USER` and `FASTLANE_PASSWORD` environment variables. (Make sure to use secret environment variables, specifically for the password.)
|
24
|
+
|
25
|
+
## Example
|
26
|
+
|
27
|
+
Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plugin. Try it by cloning the repo, running `bundle exec fastlane test`.
|
28
|
+
|
29
|
+
## Testing
|
30
|
+
|
31
|
+
To run both the tests and code style validation, run:
|
32
|
+
|
33
|
+
```bash
|
34
|
+
rake
|
35
|
+
```
|
36
|
+
|
37
|
+
To automatically fix many of the styling issues, use:
|
38
|
+
```bash
|
39
|
+
rubocop -a
|
40
|
+
```
|
41
|
+
|
42
|
+
## Troubleshooting
|
43
|
+
|
44
|
+
If you have trouble using fastlane plugins, check out fastlane's [Plugins Troubleshooting](https://docs.fastlane.tools/plugins/plugins-troubleshooting/) guide.
|
45
|
+
|
46
|
+
## About fastlane
|
47
|
+
|
48
|
+
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).
|
49
|
+
|
50
|
+
For more information about how the fastlane plugin system works, check out the [Plugins documentation](https://docs.fastlane.tools/plugins/create-plugin/).
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'fastlane/plugin/notarize/version'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Notarize
|
5
|
+
def self.all_classes
|
6
|
+
Dir[File.expand_path('**/actions/*.rb', File.dirname(__FILE__))]
|
7
|
+
end
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
Fastlane::Notarize.all_classes.each do |current|
|
12
|
+
require current
|
13
|
+
end
|
@@ -0,0 +1,132 @@
|
|
1
|
+
require 'fastlane/action'
|
2
|
+
|
3
|
+
module Fastlane
|
4
|
+
module Actions
|
5
|
+
class NotarizeAction < Action
|
6
|
+
def self.run(params)
|
7
|
+
package_path = params[:package]
|
8
|
+
bundle_id = params[:bundle_id]
|
9
|
+
|
10
|
+
# Compress and read bundle identifier only for .app bundle.
|
11
|
+
compressed_package_path = nil
|
12
|
+
if File.extname(package_path) == '.app'
|
13
|
+
compressed_package_path = "#{package_path}.zip"
|
14
|
+
Actions.sh(
|
15
|
+
"ditto -c -k --rsrc --keepParent \"#{package_path}\" \"#{compressed_package_path}\"",
|
16
|
+
log: false
|
17
|
+
)
|
18
|
+
|
19
|
+
unless bundle_id
|
20
|
+
info_plist_path = File.join(package_path, 'Contents', 'Info.plist')
|
21
|
+
bundle_id = Plist.parse_xml(info_plist_path)['CFBundleIdentifier']
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
UI.user_error!('Could not read bundle identifier, provide as a parameter.') unless bundle_id
|
26
|
+
|
27
|
+
apple_id_account = CredentialsManager::AccountManager.new(user: params[:username])
|
28
|
+
|
29
|
+
# Add password as a temporary environment variable for altool.
|
30
|
+
ENV['FL_NOTARIZE_PASSWORD'] = apple_id_account.password
|
31
|
+
|
32
|
+
UI.message('Uploading package to notarization service, might take a while')
|
33
|
+
|
34
|
+
notarization_upload_response = Actions.sh(
|
35
|
+
"xcrun altool --notarize-app -t osx -f \"#{compressed_package_path || package_path}\" --primary-bundle-id #{bundle_id} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD --output-format xml",
|
36
|
+
log: false
|
37
|
+
)
|
38
|
+
|
39
|
+
FileUtils.rm_rf(compressed_package_path) if compressed_package_path
|
40
|
+
|
41
|
+
notarization_upload_plist = Plist.parse_xml(notarization_upload_response)
|
42
|
+
notarization_request_id = notarization_upload_plist['notarization-upload']['RequestUUID']
|
43
|
+
|
44
|
+
UI.success("Successfully uploaded package to notarization service with request identifier #{notarization_request_id}")
|
45
|
+
|
46
|
+
notarization_info = {}
|
47
|
+
while notarization_info.empty? || (notarization_info['Status'] == 'in progress')
|
48
|
+
if notarization_info.empty?
|
49
|
+
UI.message('Waiting to query request status')
|
50
|
+
else
|
51
|
+
UI.message('Request in progress, waiting to query again')
|
52
|
+
end
|
53
|
+
|
54
|
+
sleep(30)
|
55
|
+
|
56
|
+
UI.message('Querying request status')
|
57
|
+
|
58
|
+
notarization_info_response = Actions.sh(
|
59
|
+
"xcrun altool --notarization-info #{notarization_request_id} -u #{apple_id_account.user} -p @env:FL_NOTARIZE_PASSWORD --output-format xml",
|
60
|
+
log: false
|
61
|
+
)
|
62
|
+
|
63
|
+
notarization_info_plist = Plist.parse_xml(notarization_info_response)
|
64
|
+
notarization_info = notarization_info_plist['notarization-info']
|
65
|
+
end
|
66
|
+
|
67
|
+
log_url = notarization_info['LogFileURL']
|
68
|
+
log_suffix = ''
|
69
|
+
if log_url
|
70
|
+
log_response = Net::HTTP.get(URI(log_url))
|
71
|
+
log_json_object = JSON.parse(log_response)
|
72
|
+
log_suffix = ", with log:\n#{JSON.pretty_generate(log_json_object)}"
|
73
|
+
end
|
74
|
+
|
75
|
+
case notarization_info['Status']
|
76
|
+
when 'success'
|
77
|
+
UI.message('Stapling package')
|
78
|
+
|
79
|
+
Actions.sh(
|
80
|
+
"xcrun stapler staple \"#{package_path}\"",
|
81
|
+
log: false
|
82
|
+
)
|
83
|
+
|
84
|
+
UI.success("Successfully notarized and stapled package#{log_suffix}")
|
85
|
+
when 'invalid'
|
86
|
+
UI.user_error!("Could not notarize package with message '#{notarization_info['Status Message']}'#{log_suffix}")
|
87
|
+
else
|
88
|
+
UI.crash!("Could not notarize package with status '#{notarization_info['Status']}'#{log_suffix}")
|
89
|
+
end
|
90
|
+
ensure
|
91
|
+
ENV.delete('FL_NOTARIZE_PASSWORD')
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.description
|
95
|
+
'Notarizes a macOS app'
|
96
|
+
end
|
97
|
+
|
98
|
+
def self.authors
|
99
|
+
['zeplin']
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.available_options
|
103
|
+
username = CredentialsManager::AppfileConfig.try_fetch_value(:apple_dev_portal_id)
|
104
|
+
username ||= CredentialsManager::AppfileConfig.try_fetch_value(:apple_id)
|
105
|
+
|
106
|
+
[
|
107
|
+
FastlaneCore::ConfigItem.new(key: :package,
|
108
|
+
env_name: 'FL_NOTARIZE_PACKAGE',
|
109
|
+
description: 'Path to package to notarize, e.g. .app bundle or disk image',
|
110
|
+
is_string: true,
|
111
|
+
verify_block: proc do |value|
|
112
|
+
UI.user_error!("Could not find package at '#{value}'") unless File.exist?(value)
|
113
|
+
end),
|
114
|
+
FastlaneCore::ConfigItem.new(key: :bundle_id,
|
115
|
+
env_name: 'FL_NOTARIZE_BUNDLE_ID',
|
116
|
+
description: 'Bundle identifier to uniquely identify the package',
|
117
|
+
optional: true,
|
118
|
+
is_string: true),
|
119
|
+
FastlaneCore::ConfigItem.new(key: :username,
|
120
|
+
env_name: 'FL_NOTARIZE_USERNAME',
|
121
|
+
description: 'Apple ID username',
|
122
|
+
default_value: username,
|
123
|
+
default_value_dynamic: true)
|
124
|
+
]
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.is_supported?(platform)
|
128
|
+
platform == :mac
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
132
|
+
end
|
metadata
ADDED
@@ -0,0 +1,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fastlane-plugin-notarize
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Zeplin, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-01-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: pry
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec_junit_formatter
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 0.49.1
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 0.49.1
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: fastlane
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 2.112.0
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 2.112.0
|
125
|
+
description:
|
126
|
+
email: support@zeplin.io
|
127
|
+
executables: []
|
128
|
+
extensions: []
|
129
|
+
extra_rdoc_files: []
|
130
|
+
files:
|
131
|
+
- LICENSE
|
132
|
+
- README.md
|
133
|
+
- lib/fastlane/plugin/notarize.rb
|
134
|
+
- lib/fastlane/plugin/notarize/actions/notarize_action.rb
|
135
|
+
- lib/fastlane/plugin/notarize/version.rb
|
136
|
+
homepage: https://github.com/zeplin/fastlane-plugin-notarize
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.5.2.3
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: fastlane plugin to notarize a macOS app
|
160
|
+
test_files: []
|