Files
cocos/tools/deploy-cdn.sh
刘宇飞 d393302388 Complete Cocos Creator port with level bundles, themes, and tooling.
Adds level prefabs, theme assets, audio, extensions, and deployment scripts for the Unity WebGL migration.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-16 15:30:58 +08:00

63 lines
1.8 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# CDN 部署:打包单一运行时包 + 生成上传清单
#
# bash tools/deploy-cdn.sh
# bash tools/deploy-cdn.sh --with-static
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
usage() {
cat <<'EOF'
CDN 部署usecdn:true
bash tools/deploy-cdn.sh # 打包 + 清单
bash tools/deploy-cdn.sh --with-static # 同时同步 static/unity
产物:
build/mstest5/ 运行时包 ← 上传 OSS与本地 static/unity 相同)
build/deploy/ 上传清单(不进 OSS
build/standalone-player/ 独立调试页(不进 OSS
EOF
}
CDN_BASE=""
SKIP_VERIFY=0
SKIP_PACK=0
DRY_RUN=0
UPLOAD_ONLY=0
WITH_STATIC=0
while [[ $# -gt 0 ]]; do
case "$1" in
--build) BUILD_DIR="$2"; shift 2 ;;
--code-html) CODE_HTML="$2"; shift 2 ;;
--cdn-base) CDN_BASE="$2"; shift 2 ;;
--upload-only) UPLOAD_ONLY=1; shift ;;
--with-static) WITH_STATIC=1; shift ;;
--skip-verify) SKIP_VERIFY=1; shift ;;
--skip-pack) SKIP_PACK=1; shift ;;
--dry-run) DRY_RUN=1; shift ;;
-h|--help) usage; exit 0 ;;
*) echo "未知参数: $1" >&2; usage; exit 1 ;;
esac
done
BUILD_DIR="${BUILD_DIR:-$PROJECT_DIR/build/web-desktop}"
CODE_HTML="${CODE_HTML:-$HOME/tfrh/001code/001code-html}"
ARGS=(--build "$BUILD_DIR" --code-html "$CODE_HTML")
[[ -n "$CDN_BASE" ]] && ARGS+=(--cdn-base "$CDN_BASE")
[[ "$SKIP_PACK" -eq 1 ]] && ARGS+=(--skip-pack)
[[ "$DRY_RUN" -eq 1 ]] && ARGS+=(--dry-run)
[[ "$UPLOAD_ONLY" -eq 1 ]] && ARGS+=(--cdn-upload-only)
[[ "$WITH_STATIC" -eq 0 ]] && ARGS+=(--cdn-pure)
[[ -n "${UNITY_REF:-}" ]] && ARGS+=(--unity-ref "$UNITY_REF")
bash "$SCRIPT_DIR/deploy-to-001code.sh" "${ARGS[@]}"
echo ""
echo "==> 上传 build/mstest5/ 全部 → config.js unitycdndir"
echo "==> 清单 build/deploy/UPLOAD-MANIFEST.txt"