fastlane-plugin-setapp 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72b75b5b716e6794fa7c41084e4e6007051009f5543e610c8ded30b751064520
|
4
|
+
data.tar.gz: 19b140655decdbf092b19195804fb4ec26038c6b99d9df015391373e93e7d837
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48a06c152d5e0b80988112027359e627efda2606aee861cd30f7ddab84c5ef996c726a46689e36ae64054f82b1c41f391cf8e3c93121d9a95d21fffa04ae14d7
|
7
|
+
data.tar.gz: 974f5271ad85c5efba2a3c5b56dc3f879842f6cbe472cc870ecd689bda8a216c3b2870dc0ba425330c0e10713ffce3a141815583cf5bcd59b8542c46b5580c6c
|
data/README.md
CHANGED
@@ -46,11 +46,13 @@ Uploads new version to Setapp and save it as a draft or send to a review process
|
|
46
46
|
|
47
47
|
```ruby
|
48
48
|
upload_setapp_build(
|
49
|
-
|
49
|
+
automation_token: '...', # Your Setapp Automation token
|
50
50
|
build_path: '...', # The path to archive with a new Setapp build
|
51
51
|
release_notes: '...', # Text or path to a file that contains release notes for a new version
|
52
52
|
version_status: 'review', # Version status. It can be `draft` or `review`
|
53
|
-
release_on_approval: true # Indicates whether Setapp must publish a new version after review
|
53
|
+
release_on_approval: true, # Indicates whether Setapp must publish a new version after review
|
54
|
+
is_beta: false, # Is beta or stable build
|
55
|
+
allow_overwrite: true # Allow to overwrite existing version
|
54
56
|
)
|
55
57
|
```
|
56
58
|
|
@@ -5,15 +5,27 @@ module Fastlane
|
|
5
5
|
module Actions
|
6
6
|
class UploadSetappBuildAction < Action
|
7
7
|
def self.run(params)
|
8
|
-
|
8
|
+
automation_token = params[:automation_token]
|
9
9
|
build_path = params[:build_path]
|
10
10
|
release_notes = params[:release_notes]
|
11
11
|
version_status = params[:version_status]
|
12
|
-
release_on_approval = params[:release_on_approval]
|
12
|
+
release_on_approval = params[:release_on_approval] ? "true" : "false"
|
13
|
+
is_beta = params[:is_beta] ? "true" : "false"
|
14
|
+
allow_overwrite = params[:allow_overwrite] ? "true" : "false"
|
13
15
|
file_dir = File.dirname(__FILE__)
|
14
16
|
UI.user_error!("Available options for version_status: [draft, review].") unless ['draft', 'review'].include?(version_status)
|
15
17
|
UI.message("The build at path #{build_path} will be uploaded to Setapp")
|
16
|
-
|
18
|
+
script_path = "#{file_dir}/../helper/setapp_build_uploader.sh"
|
19
|
+
exit_code = system(
|
20
|
+
"bash", script_path,
|
21
|
+
"--token", automation_token,
|
22
|
+
"--path", build_path,
|
23
|
+
"--notes", release_notes,
|
24
|
+
"--status", version_status,
|
25
|
+
"--release-on-approval", release_on_approval,
|
26
|
+
"--beta", is_beta,
|
27
|
+
"--allow-overwrite", allow_overwrite
|
28
|
+
)
|
17
29
|
UI.user_error!("Uploading error occured. Try again.") if exit_code != true
|
18
30
|
end
|
19
31
|
|
@@ -39,9 +51,9 @@ module Fastlane
|
|
39
51
|
def self.available_options
|
40
52
|
[
|
41
53
|
FastlaneCore::ConfigItem.new(
|
42
|
-
key: :
|
43
|
-
env_name: "
|
44
|
-
description: "Your Setapp
|
54
|
+
key: :automation_token,
|
55
|
+
env_name: "SETAPP_AUTOMATION_TOKEN",
|
56
|
+
description: "Your Setapp Automation token",
|
45
57
|
optional: false,
|
46
58
|
sensitive: true,
|
47
59
|
type: String
|
@@ -73,6 +85,22 @@ module Fastlane
|
|
73
85
|
description: "Indicate whether Setapp must release new version automatically after review. Available options: `true`, `false`",
|
74
86
|
optional: false,
|
75
87
|
type: Boolean
|
88
|
+
),
|
89
|
+
FastlaneCore::ConfigItem.new(
|
90
|
+
key: :is_beta,
|
91
|
+
env_name: "SETAPP_BUILD_IS_BETA",
|
92
|
+
description: "Is beta or stable build. Available options: `true`, `false`",
|
93
|
+
optional: false,
|
94
|
+
default_value: false,
|
95
|
+
type: Boolean
|
96
|
+
),
|
97
|
+
FastlaneCore::ConfigItem.new(
|
98
|
+
key: :allow_overwrite,
|
99
|
+
env_name: "SETAPP_ALLOW_OVERWRITE",
|
100
|
+
description: "Can overwrite existing version or not. Applies to all statuses except `Approved`. Available options: `true`, `false`",
|
101
|
+
optional: false,
|
102
|
+
default_value: false,
|
103
|
+
type: Boolean
|
76
104
|
)
|
77
105
|
]
|
78
106
|
end
|
@@ -18,12 +18,12 @@ function help() {
|
|
18
18
|
|
19
19
|
OPTIONS
|
20
20
|
-t, --token
|
21
|
-
Your Setapp token for continious integration.
|
21
|
+
Your Setapp Automation token for continious integration.
|
22
22
|
|
23
23
|
-p, --path
|
24
24
|
Path to an archive with a new bundle version.
|
25
25
|
|
26
|
-
-n,
|
26
|
+
-n, --notes
|
27
27
|
Release notes for a new version. Add them as a plain text or as a path to file with text.
|
28
28
|
|
29
29
|
-s, --status
|
@@ -35,6 +35,14 @@ function help() {
|
|
35
35
|
Indicate whether Setapp must publish a new version automatically after review approval.
|
36
36
|
Available options: (true/false)
|
37
37
|
|
38
|
+
-b | --beta
|
39
|
+
Is beta or stable build.
|
40
|
+
Available options: (true/false)
|
41
|
+
|
42
|
+
-a | --allow-overwrite
|
43
|
+
Can ovewrite existing version, including release notes and archive.
|
44
|
+
Available options: (true/false)
|
45
|
+
|
38
46
|
-h, --help
|
39
47
|
Usage help
|
40
48
|
"
|
@@ -53,7 +61,7 @@ function parse_params() {
|
|
53
61
|
;;
|
54
62
|
-t | --token)
|
55
63
|
if test $# -gt 0; then
|
56
|
-
|
64
|
+
automation_token="${1}"
|
57
65
|
fi
|
58
66
|
shift;;
|
59
67
|
-p | --path)
|
@@ -79,6 +87,16 @@ function parse_params() {
|
|
79
87
|
release_on_approval="${1}"
|
80
88
|
fi
|
81
89
|
shift;;
|
90
|
+
-b | --beta)
|
91
|
+
if test $# -gt 0; then
|
92
|
+
beta="${1}"
|
93
|
+
fi
|
94
|
+
shift;;
|
95
|
+
-a| --allow-overwrite)
|
96
|
+
if test $# -gt 0; then
|
97
|
+
allow_overwrite="${1}"
|
98
|
+
fi
|
99
|
+
shift;;
|
82
100
|
*)
|
83
101
|
die "Invalid parameter was provided: $param" 1
|
84
102
|
;;
|
@@ -87,11 +105,13 @@ function parse_params() {
|
|
87
105
|
}
|
88
106
|
|
89
107
|
function check_parameters() {
|
90
|
-
[[ -z "${
|
91
|
-
[[ -z "${archive_path}" ]] && die "Missing required parameter:
|
92
|
-
[[ -z "${release_notes}" ]] && die "Missing required parameter:
|
93
|
-
[[ -z "${version_status}" ]] && die "Missing required parameter:
|
108
|
+
[[ -z "${automation_token}" ]] && die "Missing required parameter: token"
|
109
|
+
[[ -z "${archive_path}" ]] && die "Missing required parameter: path"
|
110
|
+
[[ -z "${release_notes}" ]] && die "Missing required parameter: notes"
|
111
|
+
[[ -z "${version_status}" ]] && die "Missing required parameter: status"
|
94
112
|
[[ -z "${release_on_approval}" ]] && die "Missing required parameter: release-on-approval"
|
113
|
+
[[ -z "${beta}" ]] && die "Missing required parameter: beta"
|
114
|
+
[[ -z "${allow_overwrite}" ]] && die "Missing required parameter: allow-ovewrite"
|
95
115
|
}
|
96
116
|
|
97
117
|
function validate_server_response() {
|
@@ -102,7 +122,7 @@ function validate_server_response() {
|
|
102
122
|
if [ "$response_code" -ge 200 ] && [ "$response_code" -lt 300 ]; then
|
103
123
|
echo "✅ The app version is uploaded. All checks are passed."
|
104
124
|
elif [ $response_code -eq 401 ]; then
|
105
|
-
die "⚠️ Something went wrong with your
|
125
|
+
die "⚠️ Something went wrong with your Setapp Automation token.\n${response_body}"
|
106
126
|
elif [ $response_code -eq 400 ]; then
|
107
127
|
die "🚨 Bundle validation error occured. See details in description below.\n${response_body}"
|
108
128
|
else
|
@@ -110,16 +130,18 @@ function validate_server_response() {
|
|
110
130
|
fi
|
111
131
|
}
|
112
132
|
|
113
|
-
function
|
133
|
+
function create_or_overwrite_existing_app_version() {
|
114
134
|
response=$(
|
115
135
|
curl -X POST "https://developer-api.setapp.com/v1/ci/version" \
|
116
136
|
--write-out "HTTPSTATUS:%{http_code}" \
|
117
|
-
-H "Authorization: Bearer ${
|
137
|
+
-H "Authorization: Bearer ${automation_token}" \
|
118
138
|
-H "accept: application/json" \
|
119
139
|
-H "Content-Type: multipart/form-data" \
|
120
140
|
-F "release_notes=${release_notes}" \
|
121
141
|
-F "status=${version_status}" \
|
122
142
|
-F "release_on_approval=${release_on_approval}" \
|
143
|
+
-F "beta=${beta}" \
|
144
|
+
-F "allow_overwrite=${allow_overwrite}" \
|
123
145
|
-F "archive=@${archive_path};type=application/zip"
|
124
146
|
)
|
125
147
|
validate_server_response "${response}"
|
@@ -128,7 +150,7 @@ function upload_binary() {
|
|
128
150
|
function main() {
|
129
151
|
parse_params "$@"
|
130
152
|
check_parameters
|
131
|
-
|
153
|
+
create_or_overwrite_existing_app_version
|
132
154
|
}
|
133
155
|
|
134
156
|
main "$@"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-setapp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Setapp Limited
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|