easyci 1.0.4 → 1.1.7
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 +4 -4
- data/lib/easyci/command/unitydraw.rb +57 -7
- data/lib/easyci/version.rb +3 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 480eba74298dfe03c29f4122eb8eff6d8689463477fcdaa299df3a9732b02f21
|
4
|
+
data.tar.gz: 63a3252686696c5622a40e9a884a5f18b34f7654d5f7b23b5b7415d91320289b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dea00daaf62abc9c57f60931e96cd4f3cdd4302e1bc4ffc518173ed2e04113f857e764abae8a883476519e10e640b455e2ee0a79a34833b0419098e64c69ba7d
|
7
|
+
data.tar.gz: 917e420dceb7d09075fb576f4de2e8bb349ca7259bb326bae4ba1b2bcb489fc575c619ebadde47562cbee8f02df6d077319d6443ae8c2a2c6d5d3218770945a0
|
@@ -28,7 +28,7 @@ module EasyCI
|
|
28
28
|
|
29
29
|
gitee_draw_dir = File.expand_path('~/Documents/gitee_draw')
|
30
30
|
FileUtils.mkdir_p(gitee_draw_dir)
|
31
|
-
|
31
|
+
|
32
32
|
gitee_repo = ENV['GITEE_REPO'] || 'fundesignexport/MagicSortDemoDesignExport'
|
33
33
|
gitee_repo_name = gitee_repo.split('/').last
|
34
34
|
gitee_branch = ENV['GITEE_BRANCH'] || 'master'
|
@@ -36,6 +36,15 @@ module EasyCI
|
|
36
36
|
puts "GITEE_REPO 和 GITEE_BRANCH 不能为空"
|
37
37
|
exit 1
|
38
38
|
end
|
39
|
+
|
40
|
+
ssh_host_gitee = 'gitee.com'
|
41
|
+
if !gitee_repo.empty? && gitee_repo.start_with?('fundesignexport')
|
42
|
+
ssh_host_gitee = 'gitee-fununitydraw'
|
43
|
+
elsif !gitee_repo.empty? && gitee_repo.start_with?('gooddesignexport')
|
44
|
+
ssh_host_gitee = 'gitee-joyunitydraw'
|
45
|
+
else
|
46
|
+
ssh_host_gitee = 'gitee.com'
|
47
|
+
end
|
39
48
|
|
40
49
|
work_dir = File.join(gitee_draw_dir, gitee_repo_name)
|
41
50
|
if File.exist?(work_dir)
|
@@ -65,7 +74,7 @@ module EasyCI
|
|
65
74
|
|
66
75
|
runner_dir = File.join(work_dir, runner_repo_name)
|
67
76
|
FileUtils.rm_rf(runner_dir) if File.exist?(runner_dir)
|
68
|
-
git_url = @use_https ? "https://gitee.com/#{@runner_repo}.git" : "git
|
77
|
+
git_url = @use_https ? "https://gitee.com/#{@runner_repo}.git" : "git@#{ssh_host_gitee}:#{@runner_repo}.git"
|
69
78
|
puts "git_url: #{git_url}"
|
70
79
|
clone_runner_result = system("cd #{work_dir} && git clone --depth 1 -b #{runner_branch} #{git_url} #{runner_repo_name}")
|
71
80
|
unless clone_runner_result
|
@@ -84,7 +93,7 @@ module EasyCI
|
|
84
93
|
end
|
85
94
|
FileUtils.mkdir_p(File.join(runner_dir, 'Assets'))
|
86
95
|
puts "下载截图仓库..."
|
87
|
-
git_url = @use_https ? "https://gitee.com/#{gitee_repo}.git" : "git
|
96
|
+
git_url = @use_https ? "https://gitee.com/#{gitee_repo}.git" : "git@#{ssh_host_gitee}:#{gitee_repo}.git"
|
88
97
|
puts "git_url: #{git_url}"
|
89
98
|
gitee_repo_local_path = File.join(work_dir, gitee_repo_name)
|
90
99
|
FileUtils.rm_rf(gitee_repo_local_path) if File.exist?(gitee_repo_local_path)
|
@@ -97,24 +106,65 @@ module EasyCI
|
|
97
106
|
|
98
107
|
if !File.exist?(File.join(gitee_repo_local_path, 'Resources'))
|
99
108
|
FileUtils.mkdir_p(resources_dir)
|
100
|
-
|
101
|
-
FileUtils.cp_r(File.join(gitee_repo_local_path, '
|
109
|
+
FileUtils.cp_r(File.join(gitee_repo_local_path, '2D', '.'), resources_dir)
|
110
|
+
FileUtils.cp_r(File.join(gitee_repo_local_path, 'Common/Font'), File.join(resources_dir, 'Fonts'))
|
111
|
+
# 安全复制 Language 文件夹(如果存在)
|
112
|
+
languages_path = File.join(gitee_repo_local_path, 'Common/Language')
|
113
|
+
if Dir.exist?(languages_path)
|
114
|
+
FileUtils.cp_r(languages_path, resources_dir)
|
115
|
+
else
|
116
|
+
puts "⚠️ 跳过复制:#{languages_path} 不存在"
|
117
|
+
end
|
102
118
|
else
|
103
119
|
FileUtils.mv(File.join(gitee_repo_local_path, 'Resources'), resources_dir)
|
104
120
|
end
|
105
121
|
|
122
|
+
# 如果 resources_dir 的FGUI目录下有Code文件夹,则删除
|
123
|
+
fgui_dir = File.join(resources_dir, 'FGUI')
|
124
|
+
if File.exist?(File.join(fgui_dir, 'Code'))
|
125
|
+
FileUtils.rm_rf(File.join(fgui_dir, 'Code'))
|
126
|
+
end
|
127
|
+
|
106
128
|
# 运行Unity截图任务
|
107
129
|
unity_path = find_unity_path(runner_dir)
|
108
130
|
puts "运行Unity截图任务..."
|
109
131
|
FileUtils.chdir(runner_dir)
|
110
|
-
system("#{unity_path} -projectPath #{runner_dir} -executeMethod SpineAutoImporter.CIRunner -logFile screenshot-log.txt")
|
132
|
+
system("mkdir -p ~/UnityTemp && TMPDIR=~/UnityTemp #{unity_path} -projectPath #{runner_dir} -executeMethod SpineAutoImporter.CIRunner -logFile screenshot-log.txt")
|
111
133
|
|
112
134
|
# 压缩截图
|
113
135
|
puts "开始压缩截图..."
|
114
136
|
system("cd #{runner_dir} && find . -path \"*/Screenshots/*.png\" -exec pngquant --quality=70-95 --ext .png --force {} \\;")
|
115
137
|
# 运行Node脚本(如果需要)
|
116
138
|
puts "运行后处理脚本..."
|
117
|
-
|
139
|
+
# 你想传入的变量前缀,比如 GITEE_
|
140
|
+
env_prefixes = ["GITEE_"]
|
141
|
+
|
142
|
+
# 构建 docker run 的 -e 参数
|
143
|
+
env_flags = ENV
|
144
|
+
.select { |k, _| env_prefixes.any? { |prefix| k.start_with?(prefix) } }
|
145
|
+
.map { |k, _| "-e #{k}" }
|
146
|
+
.join(" ")
|
147
|
+
|
148
|
+
# 可选:你也可以在这里补充额外变量
|
149
|
+
extra_env = {
|
150
|
+
"BUILD_FROM_PRO" => gitee_repo_name,
|
151
|
+
"BUILD_FROM_REPO" => gitee_repo
|
152
|
+
}
|
153
|
+
extra_env.each { |k, v| ENV[k] = v }
|
154
|
+
|
155
|
+
# 构建并执行命令
|
156
|
+
cmd = <<~CMD
|
157
|
+
cd #{runner_dir} && \
|
158
|
+
docker run --rm #{env_flags} \
|
159
|
+
-v "$(pwd):/app" \
|
160
|
+
-w /app \
|
161
|
+
node:22.0.0 bash -c "cd Scripts && yarn install && npx ts-node index.ts"
|
162
|
+
CMD
|
163
|
+
|
164
|
+
system(cmd)
|
165
|
+
puts "执行命令:\n#{cmd}"
|
166
|
+
# export gitee_repo 和 gitee_repo_name
|
167
|
+
# system("cd #{runner_dir} && docker run --rm -v \"$(pwd):/app\" -w /app node:22.0.0 bash -c \"cd Scripts && export BUILD_FROM_PRO=#{gitee_repo_name} && export BUILD_FROM_REPO=#{gitee_repo} && yarn install && npx ts-node index.ts\"")
|
118
168
|
|
119
169
|
end
|
120
170
|
|
data/lib/easyci/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easyci
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wade
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: claide
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.6.
|
103
|
+
rubygems_version: 3.6.9
|
104
104
|
specification_version: 4
|
105
105
|
summary: EasyCI - 简单的CI工具集
|
106
106
|
test_files: []
|