Files
testscm2/buidinfo.txt

79 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2026-05-14 19:28:21 +08:00
功能:
编译 APK
自动生成 commit.info
同时上传 APK + commit.info 到同一个版本目录
不覆盖、唯一、可追溯
脚本build_upload.sh
bash
运行
#!/bin/bash
set -e
# ==================== 配置 ====================
APP_NAME="CarLauncher"
VERSION="1.0.5"
ARTIFACTORY_URL="http://你的artifactory:8081/artifactory"
REPO_NAME="aaos-apps"
USER="账号"
PASS="密码"
# ==============================================
# 1. 获取 Git 信息
COMMIT=$(git rev-parse HEAD)
BRANCH=$(git rev-parse --abbrev-ref HEAD)
BUILD_TIME=$(date "+%Y-%m-%d %H:%M:%S")
# 2. 生成 commit.info
cat > commit.info << EOF
commit=$COMMIT
branch=$BRANCH
buildTime=$BUILD_TIME
version=$VERSION
EOF
echo "✅ 生成 commit.info"
cat commit.info
# 3. 编译 APK
./gradlew clean assembleRelease
APK_PATH="app/build/outputs/apk/release/app-release.apk"
# 4. 上传路径(同一个版本目录)
UPLOAD_APK="$ARTIFACTORY_URL/$REPO_NAME/$APP_NAME/$VERSION/$APP_NAME.apk"
UPLOAD_INFO="$ARTIFACTORY_URL/$REPO_NAME/$APP_NAME/$VERSION/commit.info"
# 5. 上传 APK
curl -u $USER:$PASS -T $APK_PATH $UPLOAD_APK
# 6. 上传 commit.info关键一起上传
curl -u $USER:$PASS -T commit.info $UPLOAD_INFO
echo -e "\n<><6E><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 上传完成!"
echo "APK: $UPLOAD_APK"
echo "INFO: $UPLOAD_INFO"
三、你最关心的问题:能一起上传吗?
✅ 能!完全能!
执行脚本后Artifactory 里会出现:
plaintext
aaos-apps/CarLauncher/1.0.5/CarLauncher.apk
aaos-apps/CarLauncher/1.0.5/commit.info
两个文件在同一个目录,一一对应,永远绑定
1. APK 版本号规则(唯一、不重复)
plaintext
版本号 = 主版本.次版本.编译号
1.0. 2025040815 → 1.0.2025040815
2. Artifactory 路径(永远不覆盖)
plaintext
aaos-apps/CarLauncher/1.0.2025040815/CarLauncher.apk
aaos-apps/CarLauncher/1.0.2025040816/CarLauncher.apk
每次编译都是新目录、新路径。
3. 统一配置文件 app_versions.yaml
手动 / 人工选择要合入 AAOS 的版本
yaml
apps:
- apk_name: CarLauncher
version: "1.0.2025040815" ✅ 固定版本
repo_path: "aaos-apps/CarLauncher/1.0.2025040815/CarLauncher.apk"