fastlane-plugin-setapp 0.1.3 → 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,12 +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
53
|
release_on_approval: true, # Indicates whether Setapp must publish a new version after review
|
54
|
-
is_beta: false # Is beta or stable build
|
54
|
+
is_beta: false, # Is beta or stable build
|
55
|
+
allow_overwrite: true # Allow to overwrite existing version
|
55
56
|
)
|
56
57
|
```
|
57
58
|
|
@@ -5,24 +5,26 @@ 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
12
|
release_on_approval = params[:release_on_approval] ? "true" : "false"
|
13
13
|
is_beta = params[:is_beta] ? "true" : "false"
|
14
|
+
allow_overwrite = params[:allow_overwrite] ? "true" : "false"
|
14
15
|
file_dir = File.dirname(__FILE__)
|
15
16
|
UI.user_error!("Available options for version_status: [draft, review].") unless ['draft', 'review'].include?(version_status)
|
16
17
|
UI.message("The build at path #{build_path} will be uploaded to Setapp")
|
17
18
|
script_path = "#{file_dir}/../helper/setapp_build_uploader.sh"
|
18
19
|
exit_code = system(
|
19
20
|
"bash", script_path,
|
20
|
-
"--token",
|
21
|
+
"--token", automation_token,
|
21
22
|
"--path", build_path,
|
22
23
|
"--notes", release_notes,
|
23
24
|
"--status", version_status,
|
24
25
|
"--release-on-approval", release_on_approval,
|
25
|
-
"--beta", is_beta
|
26
|
+
"--beta", is_beta,
|
27
|
+
"--allow-overwrite", allow_overwrite
|
26
28
|
)
|
27
29
|
UI.user_error!("Uploading error occured. Try again.") if exit_code != true
|
28
30
|
end
|
@@ -49,9 +51,9 @@ module Fastlane
|
|
49
51
|
def self.available_options
|
50
52
|
[
|
51
53
|
FastlaneCore::ConfigItem.new(
|
52
|
-
key: :
|
53
|
-
env_name: "
|
54
|
-
description: "Your Setapp
|
54
|
+
key: :automation_token,
|
55
|
+
env_name: "SETAPP_AUTOMATION_TOKEN",
|
56
|
+
description: "Your Setapp Automation token",
|
55
57
|
optional: false,
|
56
58
|
sensitive: true,
|
57
59
|
type: String
|
@@ -91,6 +93,14 @@ module Fastlane
|
|
91
93
|
optional: false,
|
92
94
|
default_value: false,
|
93
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
|
94
104
|
)
|
95
105
|
]
|
96
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
|
@@ -38,6 +38,10 @@ function help() {
|
|
38
38
|
-b | --beta
|
39
39
|
Is beta or stable build.
|
40
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)
|
41
45
|
|
42
46
|
-h, --help
|
43
47
|
Usage help
|
@@ -57,7 +61,7 @@ function parse_params() {
|
|
57
61
|
;;
|
58
62
|
-t | --token)
|
59
63
|
if test $# -gt 0; then
|
60
|
-
|
64
|
+
automation_token="${1}"
|
61
65
|
fi
|
62
66
|
shift;;
|
63
67
|
-p | --path)
|
@@ -88,6 +92,11 @@ function parse_params() {
|
|
88
92
|
beta="${1}"
|
89
93
|
fi
|
90
94
|
shift;;
|
95
|
+
-a| --allow-overwrite)
|
96
|
+
if test $# -gt 0; then
|
97
|
+
allow_overwrite="${1}"
|
98
|
+
fi
|
99
|
+
shift;;
|
91
100
|
*)
|
92
101
|
die "Invalid parameter was provided: $param" 1
|
93
102
|
;;
|
@@ -96,12 +105,13 @@ function parse_params() {
|
|
96
105
|
}
|
97
106
|
|
98
107
|
function check_parameters() {
|
99
|
-
[[ -z "${
|
100
|
-
[[ -z "${archive_path}" ]] && die "Missing required parameter:
|
101
|
-
[[ -z "${release_notes}" ]] && die "Missing required parameter:
|
102
|
-
[[ -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"
|
103
112
|
[[ -z "${release_on_approval}" ]] && die "Missing required parameter: release-on-approval"
|
104
113
|
[[ -z "${beta}" ]] && die "Missing required parameter: beta"
|
114
|
+
[[ -z "${allow_overwrite}" ]] && die "Missing required parameter: allow-ovewrite"
|
105
115
|
}
|
106
116
|
|
107
117
|
function validate_server_response() {
|
@@ -112,7 +122,7 @@ function validate_server_response() {
|
|
112
122
|
if [ "$response_code" -ge 200 ] && [ "$response_code" -lt 300 ]; then
|
113
123
|
echo "✅ The app version is uploaded. All checks are passed."
|
114
124
|
elif [ $response_code -eq 401 ]; then
|
115
|
-
die "⚠️ Something went wrong with your
|
125
|
+
die "⚠️ Something went wrong with your Setapp Automation token.\n${response_body}"
|
116
126
|
elif [ $response_code -eq 400 ]; then
|
117
127
|
die "🚨 Bundle validation error occured. See details in description below.\n${response_body}"
|
118
128
|
else
|
@@ -120,17 +130,18 @@ function validate_server_response() {
|
|
120
130
|
fi
|
121
131
|
}
|
122
132
|
|
123
|
-
function
|
133
|
+
function create_or_overwrite_existing_app_version() {
|
124
134
|
response=$(
|
125
135
|
curl -X POST "https://developer-api.setapp.com/v1/ci/version" \
|
126
136
|
--write-out "HTTPSTATUS:%{http_code}" \
|
127
|
-
-H "Authorization: Bearer ${
|
137
|
+
-H "Authorization: Bearer ${automation_token}" \
|
128
138
|
-H "accept: application/json" \
|
129
139
|
-H "Content-Type: multipart/form-data" \
|
130
140
|
-F "release_notes=${release_notes}" \
|
131
141
|
-F "status=${version_status}" \
|
132
142
|
-F "release_on_approval=${release_on_approval}" \
|
133
143
|
-F "beta=${beta}" \
|
144
|
+
-F "allow_overwrite=${allow_overwrite}" \
|
134
145
|
-F "archive=@${archive_path};type=application/zip"
|
135
146
|
)
|
136
147
|
validate_server_response "${response}"
|
@@ -139,7 +150,7 @@ function upload_binary() {
|
|
139
150
|
function main() {
|
140
151
|
parse_params "$@"
|
141
152
|
check_parameters
|
142
|
-
|
153
|
+
create_or_overwrite_existing_app_version
|
143
154
|
}
|
144
155
|
|
145
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
|