@wjwjq/release-helper 0.2.94 → 0.2.96
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/script/common.sh +13 -7
- package/dist/deploy/script/nginx.sh +2 -2
- package/dist/pack.js +7 -2
- package/dist/publish.js +3 -1
- package/dist/release.js +1 -0
- package/dist/utils.js +5 -0
- package/package.json +1 -1
|
@@ -42,10 +42,6 @@ log "-----------execute ${app_name} script-------------"
|
|
|
42
42
|
|
|
43
43
|
source "$basepath"/prompt.sh
|
|
44
44
|
|
|
45
|
-
if [[ $(whoami) != "root" ]]; then
|
|
46
|
-
echo "user:root is required!"
|
|
47
|
-
exit 1
|
|
48
|
-
fi
|
|
49
45
|
|
|
50
46
|
if [[ -z "${install_path}" ]]; then
|
|
51
47
|
echo "install path not found"
|
|
@@ -156,11 +152,13 @@ backup(){
|
|
|
156
152
|
backup_path=$backup_dir"/"$old_version"_"$time
|
|
157
153
|
mkdir -p "$backup_path"
|
|
158
154
|
|
|
159
|
-
echo "${app_name} $source_type backup at: $backup_path"
|
|
155
|
+
echo "${app_name} $source_type backup at: $backup_path" >&2
|
|
160
156
|
mv "$install_path$source_type" "$backup_path"
|
|
157
|
+
|
|
158
|
+
echo "$backup_path/$source_type"
|
|
161
159
|
fi
|
|
162
160
|
}
|
|
163
|
-
|
|
161
|
+
|
|
164
162
|
|
|
165
163
|
start() {
|
|
166
164
|
callBy=$1
|
|
@@ -237,10 +235,18 @@ start() {
|
|
|
237
235
|
fi
|
|
238
236
|
|
|
239
237
|
# 备份静态资源目录
|
|
240
|
-
backup assets;
|
|
238
|
+
backup_dir=$(backup assets);
|
|
241
239
|
|
|
242
240
|
install_assets
|
|
243
241
|
|
|
242
|
+
# 执行after.sh 脚本
|
|
243
|
+
|
|
244
|
+
# 如果backup_dir 不为空,且after.sh 脚本存在,则执行after.sh 脚本
|
|
245
|
+
if [[ -n "$backup_dir" && -f "$basepath/after.sh" ]]; then
|
|
246
|
+
source "$basepath/after.sh"
|
|
247
|
+
execute $backup_dir $install_path/assets $install_path
|
|
248
|
+
fi
|
|
249
|
+
|
|
244
250
|
# 修改/etc/nginx 用户(组)
|
|
245
251
|
chown -R $user:$usergroup "$nginx_binary_install_path"
|
|
246
252
|
chmod 744 -R "$nginx_binary_install_path"
|
|
@@ -295,12 +295,12 @@ install_nginx_from_source(){
|
|
|
295
295
|
cd "${tar_dir}"
|
|
296
296
|
|
|
297
297
|
./configure \
|
|
298
|
-
--prefix=${nginx_binary_install_path} \
|
|
299
298
|
--with-http_ssl_module \
|
|
300
299
|
--with-http_v2_module \
|
|
301
300
|
--with-http_gzip_static_module \
|
|
302
301
|
--with-http_stub_status_module \
|
|
303
|
-
--with-stream
|
|
302
|
+
--with-stream \
|
|
303
|
+
--prefix=${nginx_binary_install_path}
|
|
304
304
|
|
|
305
305
|
make && make install
|
|
306
306
|
# 检测是否安装成功
|
package/dist/pack.js
CHANGED
|
@@ -5,6 +5,7 @@ import pc from 'picocolors';
|
|
|
5
5
|
import * as tar from 'tar';
|
|
6
6
|
import { checkEnvInfo, __work_dir, __releaseDir, __dirname, releaseConf } from './prepare.js';
|
|
7
7
|
import { logger } from './logger.js';
|
|
8
|
+
import { sleep } from './utils.js';
|
|
8
9
|
import 'yaml';
|
|
9
10
|
import 'execa';
|
|
10
11
|
import 'node:url';
|
|
@@ -34,6 +35,7 @@ async function pack(version) {
|
|
|
34
35
|
const projectDir = resolve(__releaseDir, projectName);
|
|
35
36
|
const assetsDir = resolve(projectDir, "pkg/assets");
|
|
36
37
|
const nginxDir = resolve(projectDir, "pkg/nginx");
|
|
38
|
+
const scriptDir = resolve(projectDir, "script");
|
|
37
39
|
fs.cpSync(resolve(__dirname, "deploy"), projectDir, { recursive: true });
|
|
38
40
|
fs.cpSync(resolve(__work_dir, releaseConf.assetsDir), assetsDir, { recursive: true });
|
|
39
41
|
fs.writeFileSync(resolve(projectDir, "pkg", "version"), version, { encoding: "utf-8" });
|
|
@@ -79,13 +81,16 @@ async function pack(version) {
|
|
|
79
81
|
replaced: [["__root__", `${assetInstallPath}assets/`]]
|
|
80
82
|
// writeToNewFilePath: resolve(nginxDir, `${projectName}.conf`)
|
|
81
83
|
});
|
|
84
|
+
if (fs.existsSync(resolve(__releaseDir, "script", "after.sh"))) {
|
|
85
|
+
fs.copyFileSync(resolve(__releaseDir, "script", "after.sh"), resolve(scriptDir, "after.sh"));
|
|
86
|
+
}
|
|
82
87
|
logger.info(pc.green(`start to generate ${zipFileName}`));
|
|
83
88
|
const zipFilePath = resolve(__releaseDir, zipFileName);
|
|
84
89
|
await genTarPkg(__releaseDir, projectName, zipFilePath);
|
|
85
90
|
logger.success(`done to pack ${pc.green(`${zipFileName} at: ${__releaseDir}`)}`);
|
|
86
|
-
await
|
|
91
|
+
await sleep(1e3);
|
|
87
92
|
if (fs.existsSync(projectDir)) {
|
|
88
|
-
fs.rmSync(projectDir, { recursive: true, force: true });
|
|
93
|
+
fs.rmSync(projectDir, { recursive: true, force: true, maxRetries: 5, retryDelay: 1e3 });
|
|
89
94
|
}
|
|
90
95
|
return {
|
|
91
96
|
version,
|
package/dist/publish.js
CHANGED
|
@@ -9,6 +9,7 @@ import { Gitlab } from '@gitbeaker/rest';
|
|
|
9
9
|
import { releaseConf, __releaseDir } from './prepare.js';
|
|
10
10
|
import { logger } from './logger.js';
|
|
11
11
|
import { execa, $ } from 'execa';
|
|
12
|
+
import { sleep } from './utils.js';
|
|
12
13
|
import 'yaml';
|
|
13
14
|
import 'picocolors';
|
|
14
15
|
|
|
@@ -231,7 +232,8 @@ async function publish(params) {
|
|
|
231
232
|
await api.ReleaseLinks.create(id, version, pkgName, `${host}${tarUploads.full_path}`, { linkType: "package" });
|
|
232
233
|
await api.ReleaseLinks.create(id, version, md5FileName, `${host}${md5Uploads.full_path}`, { linkType: "other" });
|
|
233
234
|
await Promise.all(docUploads.map((doc) => api.ReleaseLinks.create(id, version, doc.alt, `${host}${doc.full_path}`, { linkType: "other" })));
|
|
234
|
-
|
|
235
|
+
await sleep(1e3);
|
|
236
|
+
fs.rmSync(assetFile, { force: true, maxRetries: 3, retryDelay: 1e3 });
|
|
235
237
|
logger.success(`Successfully released at: ${res._links.self} `);
|
|
236
238
|
} catch (error) {
|
|
237
239
|
logger.error("\u{1F680} ~ file: publish.js ~ error:");
|
package/dist/release.js
CHANGED
package/dist/utils.js
ADDED