Commit 983c2d64 authored by nanahira's avatar nanahira

finish

parent adba4104
# mycard-package-script
萌卡 app 打包脚本,前端没搞好的时候凑合用
## 需要安装
* tar
* zstd
* jq
* curl
## 如何使用
```bash
./pack.sh <APP 名称> <APP 路径>
```
## 变量
* `username` `password` 萌卡帐号密码,需要有那个 app 的打包权限。
* `appVersion` APP 版本号,如果不存在则从 APP 信息获取最新版本号。
* `platform` `arch` `locale` APP Depot 信息,空缺字段则用 `generic` 补全。
#!/bin/bash
# set -o errexit
source ./src/pack-utility.sh
deleteBuild "$@"
......@@ -4,6 +4,6 @@ source ./src/pack-utility.sh
cd pool
for appName in *; do
runApp "$appName" "$appName"
makeBuild "$appName" "$appName"
done
cd ..
#!/bin/bash
# set -o errexit
source ./pack-utility.sh
source ./src/pack-utility.sh
appName="$1"
appPath="$2"
if [[ -z "$appPath" ]]; then
appPath="pool/$appName"
fi
runApp $appName "$appPath"
makeBuild "$appName" "$appPath"
apiRoot=https://api.moecube.com
loginInfo=$(curl -sL -X POST $apiRoot/accounts/signin -d account=$username -d password=$password)
token=$(echo $loginInfo | jq '.token' | sed 's/"//g')
header="Authorization: $token"
apiRoot=https://api.moecube.com
loginInfo=$(curl -sL -X POST $apiRoot/accounts/signin -d account=$username -d password=$password)
token=$(echo $loginInfo | jq '.token' | sed 's/"//g')
header="Authorization: $token"
echo "Logged in."
source ./src/login.sh
source ./src/prefix.sh
if [[ -z "$platform" ]]; then
platform="generic"
fi
if [[ -z "$arch" ]]; then
arch="generic"
fi
if [[ -z "$locale" ]]; then
locale="generic"
fi
suffix="?platform=$platform&arch=$arch&locle=$locale"
runApp() {
makeBuild() {
appName="$1"
appPath="$2"
echo "Packaging $appName"
......@@ -33,3 +20,12 @@ runApp() {
echo "Finished."
cd "$currentPath"
}
deleteBuild() {
appName="$1"
if [[ -z "$appVersion" ]]; then
appVersion="$2"
fi
echo "Version: $appVersion"
curl -sL -H "$header" -X DELETE "$apiRoot/release/api/build/$appName/${appVersion}${suffix}"
}
if [[ -z "$platform" ]]; then
platform="generic"
fi
if [[ -z "$arch" ]]; then
arch="generic"
fi
if [[ -z "$locale" ]]; then
locale="generic"
fi
suffix="?platform=$platform&arch=$arch&locle=$locale"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment