Skip to content

Commit 3c17bf8

Browse files
jss-tgipcjscli
authored
feat: 添加distar部署脚本 (#6)
* wip: 添加distar前端更新脚本 * wip: 更新distar部署脚本 * wip: 修复脚本问题 --------- Co-authored-by: ipcjs.mac4 <gipcjs@gmail.com> Co-authored-by: cli <cli@debian>
1 parent 4223a58 commit 3c17bf8

11 files changed

Lines changed: 180 additions & 3 deletions

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ ip2region.xdb
66
/.env
77
/.env.local
88
/tmp
9-
/scripts/*.zip
9+
/projects/*.zip

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ docker compose config
3232

3333
### 4. 下载前端文件
3434

35+
部署distar等项目的前端:
36+
[说明文件](projects/README.md)
37+
3538
下载并提取最新的`bus`前端:
3639

3740
```sh
3841
cd /data/nginx/html
39-
/home/docker/scripts/teamcity-download-artifact.sh --build=CityBusVueAdmin_Release
42+
/home/docker/projects/teamcity-download-artifact.sh --build=CityBusVueAdmin_Release
4043
unzip CityBusVueAdmin_Release-latest.zip
4144
unzip bus.zip -d bus
4245
```
@@ -45,7 +48,7 @@ unzip bus.zip -d bus
4548

4649
```sh
4750
cd /data/nginx/html
48-
/home/docker/scripts/teamcity-download-artifact.sh --build=MaintainVbenAdmin_Release
51+
/home/docker/projects/teamcity-download-artifact.sh --build=MaintainVbenAdmin_Release
4952
unzip MaintainVbenAdmin_Release-latest.zip
5053
unzip maintain.zip -d track
5154
```

projects/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# 项目特定的配置
2+
3+
## distar前端
4+
5+
```sh
6+
# 确认https://github.com/TranscodeGroup/maintain-vben-admin仓库存在对应的版本tag
7+
# 确认 https://xn.transcodegroup.cn:8590/buildConfiguration/MaintainVbenAdmin_Release?mode=builds 已经打包出附件
8+
9+
# 下载tag版本到本地, 并解压到版本对应的文件夹
10+
/home/docker/projects/distar-beta-depoly.sh --tag=v1.15.1
11+
```

projects/distar-beta-deploy.sh

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
#!/bin/bash
2+
set -e
3+
__dirname__=$(dirname "$0")
4+
5+
BUILD_NAME="MaintainVbenAdmin_Release"
6+
CONFIG_DIR="$__dirname__/distar"
7+
WORK_DIR="/data/nginx/html/track/beta"
8+
9+
# 创建并切换到工作目录
10+
[ -d "$WORK_DIR" ] || mkdir -p "$WORK_DIR" || (echo "创建工作目录失败" && exit 1)
11+
cd "$WORK_DIR"
12+
13+
# 检查参数是否提供
14+
if [ -z "$1" ]; then
15+
echo "使用方式: $0 --tag=版本号"
16+
exit 1
17+
fi
18+
19+
# 解析参数
20+
for arg in "$@"
21+
do
22+
case $arg in
23+
--tag=*)
24+
version="${arg#*=}"
25+
shift # 移除已处理的参数
26+
;;
27+
*)
28+
echo "未知参数: $arg"
29+
exit 1
30+
;;
31+
esac
32+
done
33+
34+
# 检查版本号是否为空
35+
if [ -z "$version" ]; then
36+
echo "版本号不能为空"
37+
exit 1
38+
fi
39+
40+
# 替换点号并生成目标目录
41+
target_dir="${version//./}"
42+
43+
# 定义文件名
44+
zip_file="$BUILD_NAME-${version}.zip"
45+
46+
# 检查压缩文件是否存在,如果不存在则执行下载
47+
if [ -f "$zip_file" ]; then
48+
read -p "压缩文件 $zip_file 已存在,是否重新下载?(y/n): " confirm
49+
else
50+
confirm=y
51+
fi
52+
53+
if [ "$confirm" == "y" ]; then
54+
echo "开始下载压缩文件 $zip_file ..."
55+
if [ "$version" == "latest" ]; then
56+
"$__dirname__"/teamcity-download-artifact.sh --build=$BUILD_NAME
57+
else
58+
"$__dirname__"/teamcity-download-artifact.sh --build=$BUILD_NAME --tag="$version"
59+
fi
60+
61+
# 再次检查压缩文件是否存在
62+
if [ ! -f "$zip_file" ]; then
63+
echo "下载失败或文件仍然不存在!"
64+
exit 1
65+
fi
66+
fi
67+
68+
# 如果目标目录存在则询问是否删除
69+
if [ -d "$target_dir" ]; then
70+
read -p "目标目录 $target_dir 已存在,是否删除?(y/n): " confirm
71+
if [ "$confirm" != "y" ]; then
72+
echo "操作取消。"
73+
exit 1
74+
fi
75+
rm -rf "$target_dir"
76+
echo "删除文件夹 -> " "$target_dir"
77+
fi
78+
79+
# 创建目标目录
80+
mkdir -p "$target_dir"
81+
echo "创建文件夹 -> " "$target_dir"
82+
83+
# 解压第一个zip文件
84+
unzip -o -q "$zip_file" -d "$target_dir"
85+
86+
# 进入目标目录
87+
cd "$target_dir"
88+
89+
# 定义临时zip文件名
90+
temp_zip="maintain.zip"
91+
92+
# 检查第二个zip文件是否存在
93+
if [ ! -f "$temp_zip" ]; then
94+
echo "临时压缩文件 $temp_zip 不存在!"
95+
exit 1
96+
fi
97+
98+
# 解压第二个zip文件
99+
unzip -o -q "$temp_zip"
100+
101+
# 删除临时zip文件
102+
rm "$temp_zip"
103+
104+
cd ..
105+
# 复制配置文件
106+
cp -Rfv "$CONFIG_DIR"/* "$target_dir"
107+
108+
# 指定要处理的HTML文件
109+
cd "$target_dir"
110+
html_file="index.html"
111+
112+
# 使用sed命令进行文本替换, 网站微缩图
113+
OLD_TITLE='中车在线'
114+
NEW_TITLE='DiStarGPS'
115+
OLD_DIV='数字交通云平台'
116+
NEW_DIV='ดูแลการเดินรถของคุ'
117+
118+
# 使用sed命令进行文本替换
119+
sed -i "s|$OLD_TITLE|$NEW_TITLE|g" "$html_file"
120+
sed -i "s|$OLD_DIV|$NEW_DIV|g" "$html_file"
121+
122+
echo "替换完成:$html_file 中的 '工物员' 已被替换为 'DiStarGPS ดูแลการเดินรถของคุณ'"
123+
124+
echo "解压完成,目录 -> " "$target_dir"
125+
echo "beta路径,复制到浏览器可预览 -> " https://tripsdd.com/beta/"$target_dir"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
TripsDD Privacy Policy
2+
3+
DISTAR MANUFACTURING CO., LTD. ("TripsDD", "we", "our" or "us") respects the privacy of its users ("User" or "you"). This Privacy Policy contains the following: This This informs you of what information we collect when you visit our mobile applications (the "Services").
4+
5+
Capitalized terms not defined herein shall have the meanings given to them in our Terms of Use. This Privacy Policy is incorporated by reference. (collectively the "Terms")
6+
7+
By accessing the website and/or services. and/or use of the Site and/or Services. You agree to the terms and conditions set out in this Privacy Policy. This ("Privacy Policy") covers the collection and processing of your personal data. (as defined below) if you do not accept any of the terms provided herein; You will not be able to use the service.
8+
9+
Information we may collect:
10+
11+
We may collect two types of information and data from our users. The first type of information is anonymous information that cannot be personally identified. ("Non-Personal Information") We do not know the identities of the users for whom we collect Non-Personal Information. Non-Personal Information is anonymous information that we may receive when users use the Services. Non-Personal Information collected includes technical and behavioral information. Perhaps the most important thing Activities of service users Identity Operating system and browser Mobile device type and operating system version User screen resolution Terms of Service, User "Click Stream" on the website, Keyboard Language, etc.
12+
13+
The second type of information is personally identifiable information. ("Personal Information") This information may be personally identifiable or may be personal and/or sensitive information. By itself or together with other information provided to TripsDD, the personal information we collect includes: username, email address, telephone number. Your geographic location Your travel habits (e.g. route, travel time from one place to another), your home address Office address or other destinations you like, save or search public transit directions, routes, stations and/or routes. Search history of service users Users' most frequently used routes and stops. All user generated data User reports and opinions about the service Settings in your application, your level and user profile. Including nickname and avatar. In-app usage credits ("Credits") that you earn from using the Services, advertising IDs, user IP addresses, and other information that users choose to provide.
14+
15+
The geolocation data we collect includes detailed location and route information, including GPS signals and other information sent by mobile devices currently installed and enabled for the Service. TripsDD uses this location and route information to create location history. Details of all public transport journeys
16+
17+
We collect this information through your use of the Service and information that you voluntarily provide and/or upload to the Service. As described further in our Privacy Policy below. To provide services with the aim of improving user experience and personalizing services and security. The objectives are detailed below.
18+
19+
We will never collect any personal information from or about you without your approval. above all else It is obtained by accepting positive conditions.
20+
21+
How do we collect information about our users?
22+
23+
We mainly use two methods:
24+
25+
1. Use of the Service We collect non-personal and personal information when you access or use the Service. In other words, we understand your use of the Services and may collect, compile, and record information related to such use.
26+
27+
2. We also collect non-personal information and personal information obtained from information we receive from the Services and third-party service providers we work with.

projects/distar/_app.config.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
window.__PRODUCTION__APP__CONF__ = {
2+
VITE_GLOB_APP_TITLE: 'Distar GPS',
3+
VITE_GLOB_APP_SHORT_NAME: 'tracker-distar',
4+
VITE_GLOB_API_URL: 'http://58.82.168.197:9080',
5+
VITE_GLOB_API_URL_PREFIX: '/api',
6+
VITE_GLOB_UPLOAD_URL: '/upload',
7+
}
8+
Object.freeze(window.__PRODUCTION__APP__CONF__)
9+
Object.defineProperty(window, '__PRODUCTION__APP__CONF__', { configurable: false, writable: false })
10+

projects/distar/favicon.ico

87.9 KB
Binary file not shown.

projects/distar/favicon.png

1.5 KB
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
google-site-verification: google183c314c7b974b78.html

projects/distar/logo.png

8.51 KB
Loading

0 commit comments

Comments
 (0)