-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
executable file
·173 lines (147 loc) · 4.29 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# frozen_string_literal: true
require 'bundler/gem_tasks'
require 'app_status_notification'
require 'amazing_print'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new
require 'rubocop/rake_task'
RuboCop::RakeTask.new(:rubocop)
task(default: %i[spec rubocop])
Anyway::Settings.use_local_files = true
# ENV['ASN_PROXY'] = 'http://127.0.0.1:9999'
task :try do
AppStatusNotification.watch
end
task :prerelease do
config = AppStatusNotification::Config.new
config.accounts.each do |account|
account.apps.each do |app|
context = AppStatusNotification::Runner::Context.new(account, app, config)
client = context.client
versions = client.builds(filter: {
app: app.id,
})
ap versions
end
end
end
task :app do
config = AppStatusNotification::Config.new
config.accounts.each do |account|
account.apps.each do |app|
context = AppStatusNotification::Runner::Context.new(account, app, config)
client = context.client
edit_version = client.app_edit_version(id: app.id)
latest_build = client.app_latest_build(id: app.id)
ap latest_build
build = client.update_appstore_version_build(version_id: edit_version.id, build_id: latest_build.id)
# version = client.find_app_version(version: '4.15')
# ap version
end
end
end
task :notifications do
config = AppStatusNotification::Config.new(locale: 'en')
messages = [
{
key: 'messages.app_version_created',
app: 'App Status Notification',
version: '6.0.0',
status: 'Waiting for review'
},
{
key: 'messages.app_build_received',
app: 'App Status Notification',
version: '6.0.0',
build: '1.0'
},
{
key: 'messages.prepare_appstoreversion_build',
app: 'App Status Notification',
version: '6.0.0',
build: '1.0'
},
{
key: 'messages.success_select_appstoreversion_build',
app: 'App Status Notification',
version: '6.0.0',
build: '1.0'
},
{
key: 'messages.success_select_appstoreversion_build',
app: 'App Status Notification',
version: '6.0.0',
build: '1.0'
},
{
key: 'messages.app_store_status_changes',
app: 'App Status Notification',
version: '6.0.0',
status: 'Ready for sale'
},
{
key: 'messages.app_was_on_sale',
app: 'App Status Notification',
version: '6.0.0'
}
]
# bot = AppStatusNotification::Notification::Slack.new(
# {
# 'webhook_url' => 'https://hooks.slack.com/services/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'
# }
# )
bot = AppStatusNotification::Notification::Dingtalk.new(
{
'logger' => Logger.new(STDOUT),
'webhook_url' => 'https://oapi.dingtalk.com/robot/send?access_token=3710070db4ac7e257012a494ed083d26e55fc34516adebedb90b9a7097b9785c',
'secret' => 'SEC713673300a621e60dd7d0984061952a5389171e70663a536f5426b22b68cf5f0'
}
)
messages.each do |message|
bot.send(**message)
end
# bot = AppStatusNotification::Notification::WeCom.new(
# {
# 'logger' => Logger.new(STDOUT),
# 'webhook_url' => 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=0c9ff848-1396-4507-97da-8f97558b9f21',
# }
# )
# bot.send(**message)
bot = AppStatusNotification::Notification::Feishu.new(
{
'logger' => Logger.new(STDOUT),
'webhook_url' => 'https://open.feishu.cn/open-apis/bot/v2/hook/a4d69aa6-8532-447c-a649-eccbdede2f38',
'secret' => 'XnZs2NbV4pndSVkCPFUvWb',
}
)
bot.send(**message)
end
task :config do
config = AppStatusNotification::Config.new
ap config.to_filtered_h
end
version = AppStatusNotification::VERSION
registry = 'registry.cn-beijing.aliyuncs.com/hhz-tech/app_status_notification'
namespace :docker do
task :all do
Rake::Task['docker:build'].invoke
Rake::Task['docker:publish'].invoke
end
task :build do
puts "Building docker image ..."
Rake::Task['install'].invoke
`docker build \
--build-arg APP_STATUS_NOTIFICATION_VERSION=#{version} \
-t #{registry}:#{version} .`
end
task :publish do
puts "Pushing docker image ..."
`docker push #{registry}:#{version}`
end
task :run do
`docker run -d -it \
-v $(PWD)/config:/app/config \
-v $(PWD)/stores:/app/stores \
#{registry}:#{version}`
end
end