deployand 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/.claude/settings.local.json +9 -0
- data/.gitignore +71 -0
- data/Gemfile +10 -0
- data/README.md +219 -0
- data/Rakefile +12 -0
- data/bin/deployand +12 -0
- data/deployand.gemspec +38 -0
- data/lib/deployand/command/build.rb +168 -0
- data/lib/deployand/command/iap.rb +103 -0
- data/lib/deployand/command/init.rb +52 -0
- data/lib/deployand/command/publish.rb +189 -0
- data/lib/deployand/command.rb +58 -0
- data/lib/deployand/module/.gitkeep +0 -0
- data/lib/deployand/utils/.gitkeep +0 -0
- data/lib/deployand/version.rb +5 -0
- data/lib/deployand.rb +8 -0
- data/release_remote.sh +190 -0
- data/test_local.sh +90 -0
- metadata +147 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Deployand
|
4
|
+
class Command
|
5
|
+
class Publish < Command
|
6
|
+
self.summary = 'Publish app to Google Play Store'
|
7
|
+
self.description = <<-DESC
|
8
|
+
Upload and publish your application to Google Play Store.
|
9
|
+
Supports different release tracks (internal, alpha, beta, production)
|
10
|
+
with automatic metadata and screenshot management.
|
11
|
+
DESC
|
12
|
+
|
13
|
+
self.arguments = [
|
14
|
+
CLAide::Argument.new('TRACK', false)
|
15
|
+
]
|
16
|
+
|
17
|
+
def self.options
|
18
|
+
[
|
19
|
+
['--apk=PATH', 'Path to APK file'],
|
20
|
+
['--aab=PATH', 'Path to AAB file'],
|
21
|
+
['--track=TRACK', 'Release track (internal, alpha, beta, production)'],
|
22
|
+
['--rollout=PERCENTAGE', 'Staged rollout percentage (0-100)'],
|
23
|
+
['--release-notes=NOTES', 'Release notes for this version'],
|
24
|
+
['--release-notes-file=FILE', 'File containing release notes'],
|
25
|
+
['--skip-upload-apk', 'Skip APK/AAB upload (metadata only)'],
|
26
|
+
['--skip-upload-metadata', 'Skip metadata upload'],
|
27
|
+
['--skip-upload-images', 'Skip screenshots and images upload'],
|
28
|
+
['--dry-run', 'Validate without actually publishing']
|
29
|
+
].concat(super)
|
30
|
+
end
|
31
|
+
|
32
|
+
def initialize(argv)
|
33
|
+
@track = argv.shift_argument || argv.option('track', 'internal')
|
34
|
+
@apk_path = argv.option('apk')
|
35
|
+
@aab_path = argv.option('aab')
|
36
|
+
@rollout_percentage = argv.option('rollout')
|
37
|
+
@release_notes = argv.option('release-notes')
|
38
|
+
@release_notes_file = argv.option('release-notes-file')
|
39
|
+
@skip_upload_apk = argv.flag?('skip-upload-apk')
|
40
|
+
@skip_upload_metadata = argv.flag?('skip-upload-metadata')
|
41
|
+
@skip_upload_images = argv.flag?('skip-upload-images')
|
42
|
+
@dry_run = argv.flag?('dry-run')
|
43
|
+
super
|
44
|
+
end
|
45
|
+
|
46
|
+
def validate!
|
47
|
+
super
|
48
|
+
|
49
|
+
valid_tracks = %w[internal alpha beta production]
|
50
|
+
unless valid_tracks.include?(@track)
|
51
|
+
help! "Invalid track '#{@track}'. Valid tracks: #{valid_tracks.join(', ')}"
|
52
|
+
end
|
53
|
+
|
54
|
+
if !@skip_upload_apk && !@apk_path && !@aab_path
|
55
|
+
help! 'Either --apk or --aab path must be specified, or use --skip-upload-apk'
|
56
|
+
end
|
57
|
+
|
58
|
+
if @rollout_percentage
|
59
|
+
percentage = @rollout_percentage.to_i
|
60
|
+
if percentage < 0 || percentage > 100
|
61
|
+
help! 'Rollout percentage must be between 0 and 100'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
def run
|
67
|
+
print_info "Publishing to Google Play Store..."
|
68
|
+
print_info "Track: #{@track}"
|
69
|
+
print_info "Dry run mode" if @dry_run
|
70
|
+
|
71
|
+
authenticate_google_play
|
72
|
+
validate_app_bundle unless @skip_upload_apk
|
73
|
+
upload_app_bundle unless @skip_upload_apk
|
74
|
+
upload_metadata unless @skip_upload_metadata
|
75
|
+
upload_images unless @skip_upload_images
|
76
|
+
create_release
|
77
|
+
|
78
|
+
if @dry_run
|
79
|
+
print_success "Dry run completed successfully! No changes were made."
|
80
|
+
else
|
81
|
+
print_success "App published successfully to #{@track} track!"
|
82
|
+
print_release_info
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
private
|
87
|
+
|
88
|
+
def authenticate_google_play
|
89
|
+
print_info "Authenticating with Google Play Console..."
|
90
|
+
|
91
|
+
# TODO: Implement Google Play Console authentication
|
92
|
+
# - Load service account credentials
|
93
|
+
# - Authenticate with Google Play Developer API
|
94
|
+
# - Verify permissions for the app
|
95
|
+
|
96
|
+
print_verbose "Google Play Console authentication successful"
|
97
|
+
end
|
98
|
+
|
99
|
+
def validate_app_bundle
|
100
|
+
bundle_path = @aab_path || @apk_path
|
101
|
+
print_info "Validating app bundle: #{File.basename(bundle_path)}"
|
102
|
+
|
103
|
+
# TODO: Implement app bundle validation
|
104
|
+
# - Check file exists and is readable
|
105
|
+
# - Validate APK/AAB structure
|
106
|
+
# - Check signing and certificates
|
107
|
+
# - Verify version code and name
|
108
|
+
|
109
|
+
print_verbose "App bundle validation successful"
|
110
|
+
end
|
111
|
+
|
112
|
+
def upload_app_bundle
|
113
|
+
bundle_path = @aab_path || @apk_path
|
114
|
+
bundle_type = @aab_path ? 'AAB' : 'APK'
|
115
|
+
|
116
|
+
print_info "Uploading #{bundle_type}: #{File.basename(bundle_path)}"
|
117
|
+
|
118
|
+
unless @dry_run
|
119
|
+
# TODO: Implement app bundle upload
|
120
|
+
# - Upload APK/AAB to Google Play Console
|
121
|
+
# - Monitor upload progress
|
122
|
+
# - Handle upload errors and retries
|
123
|
+
end
|
124
|
+
|
125
|
+
print_verbose "#{bundle_type} upload completed"
|
126
|
+
end
|
127
|
+
|
128
|
+
def upload_metadata
|
129
|
+
print_info "Uploading app metadata..."
|
130
|
+
|
131
|
+
unless @dry_run
|
132
|
+
# TODO: Implement metadata upload
|
133
|
+
# - Load app metadata from configuration
|
134
|
+
# - Upload app descriptions, titles, keywords
|
135
|
+
# - Handle multiple language support
|
136
|
+
# - Update app category and content rating
|
137
|
+
end
|
138
|
+
|
139
|
+
print_verbose "Metadata upload completed"
|
140
|
+
end
|
141
|
+
|
142
|
+
def upload_images
|
143
|
+
print_info "Uploading screenshots and images..."
|
144
|
+
|
145
|
+
unless @dry_run
|
146
|
+
# TODO: Implement images upload
|
147
|
+
# - Upload app screenshots
|
148
|
+
# - Upload feature graphics and icons
|
149
|
+
# - Handle different screen densities
|
150
|
+
# - Validate image requirements
|
151
|
+
end
|
152
|
+
|
153
|
+
print_verbose "Images upload completed"
|
154
|
+
end
|
155
|
+
|
156
|
+
def create_release
|
157
|
+
print_info "Creating release on #{@track} track..."
|
158
|
+
|
159
|
+
unless @dry_run
|
160
|
+
# TODO: Implement release creation
|
161
|
+
# - Create new release on specified track
|
162
|
+
# - Set release notes
|
163
|
+
# - Configure staged rollout if specified
|
164
|
+
# - Submit for review (production track)
|
165
|
+
end
|
166
|
+
|
167
|
+
print_verbose "Release created successfully"
|
168
|
+
end
|
169
|
+
|
170
|
+
def print_release_info
|
171
|
+
print_info ""
|
172
|
+
print_info "Release Information:"
|
173
|
+
print_info " Track: #{@track}"
|
174
|
+
print_info " Rollout: #{@rollout_percentage}%" if @rollout_percentage
|
175
|
+
print_info " Bundle: #{File.basename(@aab_path || @apk_path)}"
|
176
|
+
|
177
|
+
case @track
|
178
|
+
when 'internal'
|
179
|
+
print_info " Status: Available for internal testing"
|
180
|
+
when 'alpha', 'beta'
|
181
|
+
print_info " Status: Available for #{@track} testing"
|
182
|
+
when 'production'
|
183
|
+
print_info " Status: Submitted for review"
|
184
|
+
print_info " Note: Production releases require Google Play review"
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'claide'
|
4
|
+
require 'colored2'
|
5
|
+
|
6
|
+
module Deployand
|
7
|
+
class Command < CLAide::Command
|
8
|
+
self.abstract_command = true
|
9
|
+
self.command = 'deployand'
|
10
|
+
self.version = VERSION
|
11
|
+
self.description = 'A command-line tool for automating Google Play Store deployment'
|
12
|
+
|
13
|
+
def self.options
|
14
|
+
[
|
15
|
+
['--verbose', 'Show more debugging information'],
|
16
|
+
['--silent', 'Show nothing']
|
17
|
+
].concat(super)
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
@verbose = argv.flag?('verbose')
|
22
|
+
@silent = argv.flag?('silent')
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
super
|
28
|
+
banner! if @help
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def print_info(message)
|
34
|
+
puts "[INFO] #{message}".blue unless @silent
|
35
|
+
end
|
36
|
+
|
37
|
+
def print_success(message)
|
38
|
+
puts "[SUCCESS] #{message}".green unless @silent
|
39
|
+
end
|
40
|
+
|
41
|
+
def print_error(message)
|
42
|
+
puts "[ERROR] #{message}".red
|
43
|
+
end
|
44
|
+
|
45
|
+
def print_warning(message)
|
46
|
+
puts "[WARNING] #{message}".yellow unless @silent
|
47
|
+
end
|
48
|
+
|
49
|
+
def print_verbose(message)
|
50
|
+
puts "[DEBUG] #{message}".light_black if @verbose && !@silent
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
require_relative 'command/init'
|
56
|
+
require_relative 'command/iap'
|
57
|
+
require_relative 'command/build'
|
58
|
+
require_relative 'command/publish'
|
File without changes
|
File without changes
|
data/lib/deployand.rb
ADDED
data/release_remote.sh
ADDED
@@ -0,0 +1,190 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#当前脚本目录
|
4
|
+
CURRENT_DIR=$(dirname $(readlink -f $0))
|
5
|
+
echo $CURRENT_DIR
|
6
|
+
|
7
|
+
|
8
|
+
# Make all files and directories in the current directory readable, writable, and executable for all users.
|
9
|
+
/bin/chmod -R a+rwx $CURRENT_DIR
|
10
|
+
# Change the owner of the current directory to the current user.
|
11
|
+
/usr/sbin/chown $(whoami) $CURRENT_DIR
|
12
|
+
# Change the group of the current directory to "admin".
|
13
|
+
/usr/bin/chgrp admin $CURRENT_DIR
|
14
|
+
|
15
|
+
function readConfigValue()
|
16
|
+
{
|
17
|
+
File=$1
|
18
|
+
KEY=$2
|
19
|
+
VALUE=$(grep -m 1 -o "^[ ]*$KEY[ ]*=[ ]*[\"]*.*[\"]*" $File | sed -e "s/^[ ]*$KEY[ ]*=[ ]*[\"]*//" -e "s/[\"]*$//")
|
20
|
+
echo $VALUE
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
# 自动检测当前项目名称
|
25
|
+
GEMSPEC_FILE=$(find $CURRENT_DIR -maxdepth 1 -name "*.gemspec" | head -n 1)
|
26
|
+
if [ -z "$GEMSPEC_FILE" ]; then
|
27
|
+
echo "错误: 未找到gemspec文件!"
|
28
|
+
exit 1
|
29
|
+
fi
|
30
|
+
|
31
|
+
# 从gemspec文件名获取项目名称
|
32
|
+
PROJECT_NAME=$(basename $GEMSPEC_FILE .gemspec)
|
33
|
+
echo "检测到项目: $PROJECT_NAME"
|
34
|
+
|
35
|
+
# 清理旧的gem文件
|
36
|
+
rm -rf $CURRENT_DIR/*${PROJECT_NAME}-*.gem
|
37
|
+
|
38
|
+
# 自动检测版本文件
|
39
|
+
VERSION_FILE=$(find $CURRENT_DIR/lib -name "version.rb" | head -n 1)
|
40
|
+
if [ -z "$VERSION_FILE" ]; then
|
41
|
+
echo "错误: 未找到version.rb文件!"
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
echo "检测到版本文件: $VERSION_FILE"
|
46
|
+
VERSION_KEY="VERSION"
|
47
|
+
# 改进版本号提取方式,确保只获取版本号部分
|
48
|
+
VERSION_TAG_NAME=$(grep -o "${VERSION_KEY}.*=.*['\"]\(.*\)['\"]" ${VERSION_FILE} | sed -E "s/.*['\"]([0-9]+\.[0-9]+\.[0-9]+)['\"].*/\1/")
|
49
|
+
echo "检测到版本: $VERSION_TAG_NAME"
|
50
|
+
|
51
|
+
# 验证版本号格式
|
52
|
+
if [[ ! $VERSION_TAG_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
53
|
+
echo "错误: 无法正确解析版本号,获取到的值: '$VERSION_TAG_NAME'"
|
54
|
+
echo "直接查看版本文件内容:"
|
55
|
+
cat $VERSION_FILE
|
56
|
+
exit 1
|
57
|
+
fi
|
58
|
+
TAG_NAME="v${VERSION_TAG_NAME}"
|
59
|
+
|
60
|
+
COMMIT_FILE_LIST=$(git -C $CURRENT_DIR ls-files --other --modified --exclude-standard)
|
61
|
+
echo $COMMIT_FILE_LIST
|
62
|
+
|
63
|
+
if [ -z "$COMMIT_FILE_LIST" ]; then
|
64
|
+
echo "没有需要提交的文件!"
|
65
|
+
else
|
66
|
+
echo "提交没有提交的文件!"
|
67
|
+
# $(git -C $CURRENT_DIR ls-files --other --modified --exclude-standard)
|
68
|
+
git -C $CURRENT_DIR add -A
|
69
|
+
git -C $CURRENT_DIR commit -m "res ${VERSION_TAG_NAME}"
|
70
|
+
git -C $CURRENT_DIR push
|
71
|
+
fi
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
#合并到master分支
|
76
|
+
RELEASE_BRANCH="master"
|
77
|
+
CODING_BRANCH=$(git -C $CURRENT_DIR rev-parse --abbrev-ref HEAD)
|
78
|
+
|
79
|
+
if [[ "$CODING_BRANCH" == "$RELEASE_BRANCH" ]]; then
|
80
|
+
echo "在master分支不需要处理"
|
81
|
+
else
|
82
|
+
git -C $CURRENT_DIR checkout $RELEASE_BRANCH
|
83
|
+
git -C $CURRENT_DIR merge $CODING_BRANCH
|
84
|
+
git -C $CURRENT_DIR push
|
85
|
+
|
86
|
+
git -C $CURRENT_DIR checkout $CODING_BRANCH
|
87
|
+
git -C $CURRENT_DIR merge $RELEASE_BRANCH
|
88
|
+
git -C $CURRENT_DIR push
|
89
|
+
|
90
|
+
fi
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
# 构建和安装gem
|
95
|
+
echo "构建 $PROJECT_NAME gem..."
|
96
|
+
gem build $GEMSPEC_FILE
|
97
|
+
|
98
|
+
# 查找生成的gem文件(在当前目录和CURRENT_DIR中查找)
|
99
|
+
GEM_FILE=$(find . -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
100
|
+
if [ -z "$GEM_FILE" ]; then
|
101
|
+
GEM_FILE=$(find $CURRENT_DIR -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
102
|
+
fi
|
103
|
+
|
104
|
+
if [ -n "$GEM_FILE" ]; then
|
105
|
+
echo "找到gem文件: $GEM_FILE"
|
106
|
+
echo "安装 $PROJECT_NAME-${VERSION_TAG_NAME}.gem..."
|
107
|
+
gem install --local "$GEM_FILE"
|
108
|
+
else
|
109
|
+
echo "错误: 未找到生成的gem文件! 尝试查找任何版本的gem..."
|
110
|
+
ANY_GEM=$(find . -maxdepth 1 -name "${PROJECT_NAME}-*.gem" | head -n 1)
|
111
|
+
if [ -n "$ANY_GEM" ]; then
|
112
|
+
echo "找到gem文件: $ANY_GEM"
|
113
|
+
echo "安装 $ANY_GEM..."
|
114
|
+
gem install --local "$ANY_GEM"
|
115
|
+
else
|
116
|
+
echo "未找到任何${PROJECT_NAME}的gem文件"
|
117
|
+
fi
|
118
|
+
fi
|
119
|
+
|
120
|
+
|
121
|
+
#添加tag
|
122
|
+
git -C $CURRENT_DIR checkout $RELEASE_BRANCH
|
123
|
+
EXIST_LOCAL_TAG=$(git -C $CURRENT_DIR tag --list ${TAG_NAME})
|
124
|
+
if [ -z "$EXIST_LOCAL_TAG" ]; then
|
125
|
+
#statements
|
126
|
+
echo "无本地tag:${TAG_NAME}"
|
127
|
+
else
|
128
|
+
|
129
|
+
echo "删除本地tag:${TAG_NAME}"
|
130
|
+
git -C $CURRENT_DIR tag -d ${TAG_NAME}
|
131
|
+
fi
|
132
|
+
|
133
|
+
REMOTE_EXIST_TAG=$(git -C $CURRENT_DIR ls-remote --tags origin "refs/tags/${TAG_NAME}")
|
134
|
+
if [ -z "$REMOTE_EXIST_TAG" ]; then
|
135
|
+
#statements
|
136
|
+
echo "无远程tag:${TAG_NAME}"
|
137
|
+
else
|
138
|
+
|
139
|
+
DELETE_REMOTE_TAG=""
|
140
|
+
read -p "存在远程分支,确认要删除远程分支吗?[Y/n]: " DELETE_REMOTE_TAG
|
141
|
+
case "${DELETE_REMOTE_TAG}" in
|
142
|
+
[yY][eE][sS] | [yY])
|
143
|
+
echo "删除远程tag:${TAG_NAME}"
|
144
|
+
git -C $CURRENT_DIR push origin :${TAG_NAME}
|
145
|
+
;;
|
146
|
+
# [nN][oO] | [nN])
|
147
|
+
# echo "exit!"
|
148
|
+
# exit 1
|
149
|
+
# ;;
|
150
|
+
*)
|
151
|
+
echo "Exit!"
|
152
|
+
exit 1
|
153
|
+
;;
|
154
|
+
esac
|
155
|
+
fi
|
156
|
+
|
157
|
+
git -C $CURRENT_DIR tag ${TAG_NAME}
|
158
|
+
git -C $CURRENT_DIR push origin ${TAG_NAME}
|
159
|
+
git -C $CURRENT_DIR checkout $CODING_BRANCH
|
160
|
+
|
161
|
+
|
162
|
+
# 发布gem
|
163
|
+
GEM_FILE=$(find . -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
164
|
+
if [ -z "$GEM_FILE" ]; then
|
165
|
+
GEM_FILE=$(find $CURRENT_DIR -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
166
|
+
fi
|
167
|
+
|
168
|
+
if [ -n "$GEM_FILE" ]; then
|
169
|
+
echo "找到gem文件: $GEM_FILE"
|
170
|
+
echo "发布 $GEM_FILE 到 RubyGems..."
|
171
|
+
gem push "$GEM_FILE"
|
172
|
+
else
|
173
|
+
echo "错误: 未找到要发布的gem文件! 尝试查找任何版本的gem..."
|
174
|
+
ANY_GEM=$(find . -maxdepth 1 -name "${PROJECT_NAME}-*.gem" | head -n 1)
|
175
|
+
if [ -n "$ANY_GEM" ]; then
|
176
|
+
echo "找到gem文件: $ANY_GEM"
|
177
|
+
echo "发布 $ANY_GEM 到 RubyGems..."
|
178
|
+
gem push "$ANY_GEM"
|
179
|
+
else
|
180
|
+
echo "未找到任何${PROJECT_NAME}的gem文件"
|
181
|
+
fi
|
182
|
+
fi
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
data/test_local.sh
ADDED
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#当前脚本目录
|
4
|
+
CURRENT_DIR=$(dirname $(readlink -f $0))
|
5
|
+
echo $CURRENT_DIR
|
6
|
+
|
7
|
+
|
8
|
+
# Make all files and directories in the current directory readable, writable, and executable for all users.
|
9
|
+
/bin/chmod -R a+rwx $CURRENT_DIR
|
10
|
+
# Change the owner of the current directory to the current user.
|
11
|
+
/usr/sbin/chown $(whoami) $CURRENT_DIR
|
12
|
+
# Change the group of the current directory to "admin".
|
13
|
+
/usr/bin/chgrp admin $CURRENT_DIR
|
14
|
+
|
15
|
+
function readConfigValue()
|
16
|
+
{
|
17
|
+
File=$1
|
18
|
+
KEY=$2
|
19
|
+
VALUE=$(grep -m 1 -o "^[ ]*$KEY[ ]*=[ ]*[\"]*.*[\"]*" $File | sed -e "s/^[ ]*$KEY[ ]*=[ ]*[\"]*//" -e "s/[\"]*$//")
|
20
|
+
echo $VALUE
|
21
|
+
}
|
22
|
+
|
23
|
+
|
24
|
+
# 自动检测当前项目名称
|
25
|
+
GEMSPEC_FILE=$(find $CURRENT_DIR -maxdepth 1 -name "*.gemspec" | head -n 1)
|
26
|
+
if [ -z "$GEMSPEC_FILE" ]; then
|
27
|
+
echo "错误: 未找到gemspec文件!"
|
28
|
+
exit 1
|
29
|
+
fi
|
30
|
+
|
31
|
+
# 从gemspec文件名获取项目名称
|
32
|
+
PROJECT_NAME=$(basename $GEMSPEC_FILE .gemspec)
|
33
|
+
echo "检测到项目: $PROJECT_NAME"
|
34
|
+
|
35
|
+
# 清理旧的gem文件
|
36
|
+
rm -rf $CURRENT_DIR/*${PROJECT_NAME}-*.gem
|
37
|
+
|
38
|
+
# 自动检测版本文件
|
39
|
+
VERSION_FILE=$(find $CURRENT_DIR/lib -name "version.rb" | head -n 1)
|
40
|
+
if [ -z "$VERSION_FILE" ]; then
|
41
|
+
echo "错误: 未找到version.rb文件!"
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
echo "检测到版本文件: $VERSION_FILE"
|
46
|
+
VERSION_KEY="VERSION"
|
47
|
+
# 改进版本号提取方式,确保只获取版本号部分
|
48
|
+
VERSION_TAG_NAME=$(grep -o "${VERSION_KEY}.*=.*['\"]\(.*\)['\"]" ${VERSION_FILE} | sed -E "s/.*['\"]([0-9]+\.[0-9]+\.[0-9]+)['\"].*/\1/")
|
49
|
+
echo "检测到版本: $VERSION_TAG_NAME"
|
50
|
+
|
51
|
+
# 验证版本号格式
|
52
|
+
if [[ ! $VERSION_TAG_NAME =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
53
|
+
echo "错误: 无法正确解析版本号,获取到的值: '$VERSION_TAG_NAME'"
|
54
|
+
echo "直接查看版本文件内容:"
|
55
|
+
cat $VERSION_FILE
|
56
|
+
exit 1
|
57
|
+
fi
|
58
|
+
|
59
|
+
|
60
|
+
# 构建和安装gem
|
61
|
+
echo "构建 $PROJECT_NAME gem..."
|
62
|
+
gem build $GEMSPEC_FILE
|
63
|
+
|
64
|
+
# 查找生成的gem文件(在当前目录和CURRENT_DIR中查找)
|
65
|
+
GEM_FILE=$(find . -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
66
|
+
if [ -z "$GEM_FILE" ]; then
|
67
|
+
GEM_FILE=$(find $CURRENT_DIR -maxdepth 1 -name "${PROJECT_NAME}-${VERSION_TAG_NAME}.gem" | head -n 1)
|
68
|
+
fi
|
69
|
+
|
70
|
+
if [ -n "$GEM_FILE" ]; then
|
71
|
+
echo "找到gem文件: $GEM_FILE"
|
72
|
+
echo "安装 $PROJECT_NAME-${VERSION_TAG_NAME}.gem..."
|
73
|
+
gem install --local "$GEM_FILE"
|
74
|
+
else
|
75
|
+
echo "错误: 未找到生成的gem文件! 尝试查找任何版本的gem..."
|
76
|
+
ANY_GEM=$(find . -maxdepth 1 -name "${PROJECT_NAME}-*.gem" | head -n 1)
|
77
|
+
if [ -n "$ANY_GEM" ]; then
|
78
|
+
echo "找到gem文件: $ANY_GEM"
|
79
|
+
echo "安装 $ANY_GEM..."
|
80
|
+
gem install --local "$ANY_GEM"
|
81
|
+
else
|
82
|
+
echo "未找到任何${PROJECT_NAME}的gem文件"
|
83
|
+
fi
|
84
|
+
fi
|
85
|
+
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deployand
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- DeployAnd Team
|
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: claide
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
15
|
+
requirements:
|
16
|
+
- - "~>"
|
17
|
+
- !ruby/object:Gem::Version
|
18
|
+
version: '1.1'
|
19
|
+
type: :runtime
|
20
|
+
prerelease: false
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
requirements:
|
23
|
+
- - "~>"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: '1.1'
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: colored2
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
29
|
+
requirements:
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.1'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '3.1'
|
40
|
+
- !ruby/object:Gem::Dependency
|
41
|
+
name: bundler
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '2.0'
|
47
|
+
type: :development
|
48
|
+
prerelease: false
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '2.0'
|
54
|
+
- !ruby/object:Gem::Dependency
|
55
|
+
name: rake
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '13.0'
|
61
|
+
type: :development
|
62
|
+
prerelease: false
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '13.0'
|
68
|
+
- !ruby/object:Gem::Dependency
|
69
|
+
name: rspec
|
70
|
+
requirement: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '3.0'
|
75
|
+
type: :development
|
76
|
+
prerelease: false
|
77
|
+
version_requirements: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.0'
|
82
|
+
- !ruby/object:Gem::Dependency
|
83
|
+
name: rubocop
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '1.0'
|
89
|
+
type: :development
|
90
|
+
prerelease: false
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '1.0'
|
96
|
+
description: A command-line tool for automating Google Play Store app submission,
|
97
|
+
compilation, and publishing processes
|
98
|
+
email:
|
99
|
+
- team@deployand.com
|
100
|
+
executables:
|
101
|
+
- deployand
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".claude/settings.local.json"
|
106
|
+
- ".gitignore"
|
107
|
+
- Gemfile
|
108
|
+
- README.md
|
109
|
+
- Rakefile
|
110
|
+
- bin/deployand
|
111
|
+
- deployand.gemspec
|
112
|
+
- lib/deployand.rb
|
113
|
+
- lib/deployand/command.rb
|
114
|
+
- lib/deployand/command/build.rb
|
115
|
+
- lib/deployand/command/iap.rb
|
116
|
+
- lib/deployand/command/init.rb
|
117
|
+
- lib/deployand/command/publish.rb
|
118
|
+
- lib/deployand/module/.gitkeep
|
119
|
+
- lib/deployand/utils/.gitkeep
|
120
|
+
- lib/deployand/version.rb
|
121
|
+
- release_remote.sh
|
122
|
+
- test_local.sh
|
123
|
+
homepage: https://github.com/deployand/deployand
|
124
|
+
licenses:
|
125
|
+
- MIT
|
126
|
+
metadata:
|
127
|
+
homepage_uri: https://github.com/deployand/deployand
|
128
|
+
source_code_uri: https://github.com/deployand/deployand
|
129
|
+
changelog_uri: https://github.com/deployand/deployand/blob/main/CHANGELOG.md
|
130
|
+
rdoc_options: []
|
131
|
+
require_paths:
|
132
|
+
- lib
|
133
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
134
|
+
requirements:
|
135
|
+
- - ">="
|
136
|
+
- !ruby/object:Gem::Version
|
137
|
+
version: 2.7.0
|
138
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - ">="
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
requirements: []
|
144
|
+
rubygems_version: 3.6.9
|
145
|
+
specification_version: 4
|
146
|
+
summary: Automated Google Play Store deployment tool
|
147
|
+
test_files: []
|