@wjwjq/release-helper 0.2.8 → 0.2.92
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.
- package/dist/deploy/pkg/nginx_binary/source/nginx-1.22.1.tar.gz +0 -0
- package/dist/deploy/script/common.sh +1 -0
- package/dist/deploy/script/docker-install.sh +66 -0
- package/dist/deploy/script/nginx.sh +43 -32
- package/dist/pack.js +11 -1
- package/dist/prepare.js +9 -1
- package/package.json +1 -1
- /package/dist/deploy/pkg/nginx_binary/{compile.sh → binary/compile.sh} +0 -0
- /package/dist/deploy/pkg/nginx_binary/{nginx-arm-ssl1.1.1.tar.gz → binary/nginx-arm-ssl1.1.1.tar.gz} +0 -0
- /package/dist/deploy/pkg/nginx_binary/{nginx-x86_64-ssl1.0.2.tar.gz → binary/nginx-x86_64-ssl1.0.2.tar.gz} +0 -0
- /package/dist/deploy/pkg/nginx_binary/{nginx-x86_64-ssl1.1.1.tar.gz → binary/nginx-x86_64-ssl1.1.1.tar.gz} +0 -0
- /package/dist/deploy/pkg/nginx_binary/{nginx-x86_64-ssl3.0.7.tar.gz → binary/nginx-x86_64-ssl3.0.7.tar.gz} +0 -0
|
Binary file
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
app_name=__APP_NAME__
|
|
4
|
+
backup_dir=__DOCKER_BACKUP_DIR__
|
|
5
|
+
install_path=__DOCKER_INSTALL_DIR__
|
|
6
|
+
|
|
7
|
+
# 备份文件
|
|
8
|
+
backup() {
|
|
9
|
+
echo "---------- $install_path directory isExist,start backup"
|
|
10
|
+
filename=$(date +%Y%m%d)_$(date +%H%M%S)
|
|
11
|
+
mkdir -p "${backup_dir}"-$filename
|
|
12
|
+
mv "${install_path}"* "${backup_dir}"-$filename
|
|
13
|
+
if [ $? -eq 0 ]; then
|
|
14
|
+
echo "backup success"
|
|
15
|
+
else
|
|
16
|
+
echo "warning!! backup failed"
|
|
17
|
+
fi
|
|
18
|
+
}
|
|
19
|
+
# 复制文件
|
|
20
|
+
copyFile() {
|
|
21
|
+
echo "---------- cp ${app_name} to $install_path"
|
|
22
|
+
cp -r ./../pkg/assets/* $install_path
|
|
23
|
+
if [ $? -eq 0 ]; then
|
|
24
|
+
echo "cp success"
|
|
25
|
+
else
|
|
26
|
+
echo "warning!! cp failed"
|
|
27
|
+
fi
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
# 安装
|
|
31
|
+
install() {
|
|
32
|
+
mkdir -p $install_path
|
|
33
|
+
if [ -z "$(ls -A $install_path)" ]; then
|
|
34
|
+
echo "---------- $install_path directory isEmpty"
|
|
35
|
+
else
|
|
36
|
+
backup
|
|
37
|
+
fi
|
|
38
|
+
copyFile
|
|
39
|
+
echo "install success !"
|
|
40
|
+
}
|
|
41
|
+
# 展示版本信息
|
|
42
|
+
showVersion() {
|
|
43
|
+
if [ -f "${install_path}version" ]; then
|
|
44
|
+
echo "---------- old ${app_name} Version"
|
|
45
|
+
cat "${install_path}"version
|
|
46
|
+
echo ""
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
echo "---------- will install ${app_name} Version"
|
|
50
|
+
cat ./../pkg/version
|
|
51
|
+
echo ""
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
showVersion
|
|
55
|
+
# 询问是否安装
|
|
56
|
+
echo "---------- warning!! install will replace all project files"
|
|
57
|
+
read -p "Are you sure?[y/n]" input
|
|
58
|
+
if [ $input = "y" ];then
|
|
59
|
+
install
|
|
60
|
+
elif [ $input = "n" ]; then
|
|
61
|
+
echo "exit"
|
|
62
|
+
exit
|
|
63
|
+
else
|
|
64
|
+
echo "input error! exit"
|
|
65
|
+
exit
|
|
66
|
+
fi
|
|
@@ -234,9 +234,9 @@ function check_dependency(){
|
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
log "install nginx
|
|
237
|
+
|
|
238
|
+
install_nginx_from_binary(){
|
|
239
|
+
log "start to install nginx binary"
|
|
240
240
|
|
|
241
241
|
arch=$(uname -m)
|
|
242
242
|
ssl_version=$(openssl version | grep -oP '\d+\.\d+' | sed -n '1p' 2>&1)
|
|
@@ -265,7 +265,7 @@ install_nginx_binary() {
|
|
|
265
265
|
ssl_version="1.0.2"
|
|
266
266
|
fi
|
|
267
267
|
|
|
268
|
-
pkg="$nginx_binary_pkg_path"/nginx-"$arch"-ssl"$ssl_version".tar.gz
|
|
268
|
+
pkg="$nginx_binary_pkg_path"/binary/nginx-"$arch"-ssl"$ssl_version".tar.gz
|
|
269
269
|
|
|
270
270
|
if [ ! -f "$pkg" ]; then
|
|
271
271
|
log_error "Fatal error: nginx-$arch-ssl$ssl_version.tar.gz not matched! contact developer!"
|
|
@@ -276,44 +276,55 @@ install_nginx_binary() {
|
|
|
276
276
|
|
|
277
277
|
tar -zxvhf "$pkg" -C "$nginx_binary_install_path" --strip-components 1
|
|
278
278
|
|
|
279
|
-
# check_dependency
|
|
280
|
-
# # 检测是否安装成功
|
|
281
|
-
# if [[ $? == 0 ]]; then
|
|
282
|
-
# log_success "dependency installation successfully!"
|
|
283
|
-
# else
|
|
284
|
-
# log_error "dependency installation failed!"
|
|
285
|
-
# fi
|
|
286
|
-
|
|
287
|
-
# log "start to complie and install nginx"
|
|
288
|
-
|
|
289
|
-
# tar_name=$(ls ${nginx_binary_pkg_path}|grep nginx-.*.tar.gz)
|
|
290
|
-
# tar_dir=${tar_name%.tar.gz*}
|
|
291
|
-
# tar -zxvf "${nginx_binary_pkg_path}"/"${tar_name}"
|
|
292
|
-
# cd "${tar_dir}"
|
|
293
|
-
|
|
294
|
-
# ./configure \
|
|
295
|
-
# --prefix=${nginx_binary_install_path} \
|
|
296
|
-
# --with-http_ssl_module \
|
|
297
|
-
# --with-http_v2_module \
|
|
298
|
-
# --with-http_gzip_static_module \
|
|
299
|
-
# --with-http_stub_status_module \
|
|
300
|
-
# --with-stream
|
|
301
|
-
|
|
302
|
-
# make && make install
|
|
303
279
|
# 检测是否安装成功
|
|
304
280
|
if [[ $? == 0 ]]; then
|
|
305
281
|
log_success "nginx installation successfully!"
|
|
306
282
|
else
|
|
307
283
|
log_error "nginx installation failed!"
|
|
308
284
|
fi
|
|
285
|
+
}
|
|
309
286
|
|
|
310
|
-
|
|
287
|
+
|
|
288
|
+
install_nginx_from_source(){
|
|
289
|
+
log "start to complie and install nginx"
|
|
290
|
+
pkg="$nginx_binary_pkg_path"/source/
|
|
291
|
+
tar_name=$(ls ${pkg}|grep nginx-.*.tar.gz)
|
|
292
|
+
tar_dir=${tar_name%.tar.gz*}
|
|
293
|
+
tar -zxvf "${pkg}"/"${tar_name}"
|
|
294
|
+
cd "${tar_dir}"
|
|
295
|
+
|
|
296
|
+
./configure \
|
|
297
|
+
--prefix=${nginx_binary_install_path} \
|
|
298
|
+
--with-http_ssl_module \
|
|
299
|
+
--with-http_v2_module \
|
|
300
|
+
--with-http_gzip_static_module \
|
|
301
|
+
--with-http_stub_status_module \
|
|
302
|
+
--with-stream
|
|
303
|
+
|
|
304
|
+
make && make install
|
|
305
|
+
# 检测是否安装成功
|
|
306
|
+
if [[ $? == 0 ]]; then
|
|
307
|
+
log_success "nginx installation successfully!"
|
|
308
|
+
else
|
|
309
|
+
log_error "nginx installation failed!"
|
|
310
|
+
fi
|
|
311
|
+
|
|
312
|
+
cp $nginx_binary_install_path/conf/mime.types $nginx_binary_install_path
|
|
313
|
+
cd ..
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
# 安装nginx可执行程序
|
|
317
|
+
install_nginx_binary() {
|
|
318
|
+
log "install nginx to path: ${nginx_binary_install_path}"
|
|
319
|
+
|
|
320
|
+
if [[ "${nginx_install_mode}" == "source" ]]; then
|
|
321
|
+
install_nginx_from_source
|
|
322
|
+
else
|
|
323
|
+
install_nginx_from_binary
|
|
324
|
+
fi
|
|
311
325
|
|
|
312
326
|
mkdir -p /usr/local/bin
|
|
313
327
|
mkdir -p /var/log/nginx
|
|
314
328
|
ln -sf "$nginx_binary_install_path"sbin/nginx /usr/sbin/nginx
|
|
315
|
-
# cd ..
|
|
316
|
-
|
|
317
|
-
|
|
318
329
|
}
|
|
319
330
|
#------------------------------------ nginx 可执行程序相关 end ----------------------------------
|
package/dist/pack.js
CHANGED
|
@@ -49,7 +49,8 @@ async function pack(version) {
|
|
|
49
49
|
["__APP_NAME__", `"${projectName}"`],
|
|
50
50
|
["__INSTALL_PATH__", assetInstallPath],
|
|
51
51
|
["__USER__", releaseConf.user],
|
|
52
|
-
["__USER_GROUP__", releaseConf.userGroup]
|
|
52
|
+
["__USER_GROUP__", releaseConf.userGroup],
|
|
53
|
+
["__NGINX_INSTALL_MODE__", releaseConf.nginxInstallMode]
|
|
53
54
|
]
|
|
54
55
|
});
|
|
55
56
|
replaceFileContent({
|
|
@@ -58,6 +59,14 @@ async function pack(version) {
|
|
|
58
59
|
["__INSTALL_MODE__", releaseConf.installMode]
|
|
59
60
|
]
|
|
60
61
|
});
|
|
62
|
+
replaceFileContent({
|
|
63
|
+
filePath: resolve(projectDir, "script", "docker-install.sh"),
|
|
64
|
+
replaced: [
|
|
65
|
+
["__APP_NAME__", `"${projectName}"`],
|
|
66
|
+
["__DOCKER_BACKUP_DIR__", releaseConf.dockerBackupDir],
|
|
67
|
+
["__DOCKER_INSTALL_DIR__", releaseConf.dockerInstallDir]
|
|
68
|
+
]
|
|
69
|
+
});
|
|
61
70
|
logger.info(pc.green(`start to replace version: ${version} in index.html`));
|
|
62
71
|
replaceFileContent({
|
|
63
72
|
filePath: resolve(assetsDir, "index.html"),
|
|
@@ -74,6 +83,7 @@ async function pack(version) {
|
|
|
74
83
|
const zipFilePath = resolve(__releaseDir, zipFileName);
|
|
75
84
|
await genTarPkg(__releaseDir, projectName, zipFilePath);
|
|
76
85
|
logger.success(`done to pack ${pc.green(`${zipFileName} at: ${__releaseDir}`)}`);
|
|
86
|
+
await new Promise((resolve2) => setTimeout(resolve2, 1e3));
|
|
77
87
|
if (fs.existsSync(projectDir)) {
|
|
78
88
|
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
79
89
|
}
|
package/dist/prepare.js
CHANGED
|
@@ -8,6 +8,7 @@ import { logger } from './logger.js';
|
|
|
8
8
|
import 'picocolors';
|
|
9
9
|
|
|
10
10
|
const installMode = ["standalone", "cluster", "static", "all"];
|
|
11
|
+
const NginxInstallMode = ["source", "binary"];
|
|
11
12
|
const __work_dir = process.env.INIT_CWD || process.cwd();
|
|
12
13
|
const __releaseDir = resolve(__work_dir, ".release");
|
|
13
14
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -37,7 +38,10 @@ const releaseConf = Object.assign({
|
|
|
37
38
|
user: "root",
|
|
38
39
|
userGroup: "root",
|
|
39
40
|
installMode: "both",
|
|
40
|
-
installDir: "/opt"
|
|
41
|
+
installDir: "/opt",
|
|
42
|
+
nginxInstallMode: "binary",
|
|
43
|
+
dockerInstallDir: "",
|
|
44
|
+
dockerBackupDir: ""
|
|
41
45
|
}, parseConf(__releaseConfPath));
|
|
42
46
|
async function prepare({ callBy } = { callBy: "postinstall" }) {
|
|
43
47
|
const copyFiles = () => {
|
|
@@ -83,6 +87,10 @@ async function checkEnvInfo() {
|
|
|
83
87
|
logger.error(`The field: [${field}]'s value should be one of ${installMode.join(" | ")}`);
|
|
84
88
|
process.exit(1);
|
|
85
89
|
}
|
|
90
|
+
if (field === "nginxInstallMode" && !NginxInstallMode.includes(value)) {
|
|
91
|
+
logger.error(`The field: [${field}]'s value should be one of ${NginxInstallMode.join(" | ")}`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
86
94
|
if (field === "installDir" && !isValidLinuxPath(value)) {
|
|
87
95
|
logger.error(`The field: [${field}]'s value is not a legal path`);
|
|
88
96
|
process.exit(1);
|
package/package.json
CHANGED
|
File without changes
|
/package/dist/deploy/pkg/nginx_binary/{nginx-arm-ssl1.1.1.tar.gz → binary/nginx-arm-ssl1.1.1.tar.gz}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|