@@ -21,16 +21,18 @@ finish-args:
2121 - --share=network
2222
2323modules :
24- # 主应用模块(已合并 sources json,直接处理缓存)
2524 - name : 02Engine
2625 buildsystem : simple
2726 build-options :
2827 append-path : /usr/lib/sdk/node20/bin:$PATH
2928 env :
3029 npm_config_nodedir : /usr/lib/sdk/node20
31- npm_config_cache : /run/build/02Engine/npm-cache # 使用模块自己的缓存路径
30+ npm_config_cache : /run/build/02Engine/npm-cache
3231 npm_config_offline : ' true'
3332 ELECTRON_ENABLE_LOGGING : ' 1'
33+ # 强制 git 操作走 https(最强方式)
34+ GIT_SSH_COMMAND : " ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" # 但我们不用 ssh
35+ GIT_SSL_NO_VERIFY : " true" # 可选,如果 https 有证书问题
3436
3537 sources :
3638 - type : git
@@ -45,51 +47,47 @@ modules:
4547 url : https://raw.githubusercontent.com/02engine/desktop/main/flatpak/package-lock.json
4648 dest-filename : package-lock.json
4749 sha256 : 191a5d5ce4bc8ef0f19c9c0fcba6a0b2ef68b048705764d7ee8ef0771e430302
48- # 直接把 generated-sources.json 放这里,确保下载的 tarball 进入本模块缓存
4950 - flatpak/generated-sources.json
5051
5152 build-commands :
52- # ──────────────────────────────── 强制 git SSH → HTTPS 重定向 ────────────────────────────────
53- # 这步在沙箱里运行,确保 npm 触发的任何 git 操作都走 https
54- - git config --global url."https://github.com/".insteadOf "git@github.com:"
55- - git config --global url."https://".insteadOf "ssh://git@github.com/"
56- - git config --global url."https://".insteadOf "git://github.com/" # 覆盖 git:// 协议(极少见)
57- # debug: 确认配置生效
58- - echo "=== DEBUG : Git config for github 重定向 ==="
59- - git config --global --list | grep -i github || echo "No github url insteadOf rules found"
60-
61- # ──────────────────────────────── DEBUG: 基本环境检查 ────────────────────────────────
53+ # ──────────────────────────────── 强制禁用所有 git ssh 操作 ────────────────────────────────
54+ - echo "=== DEBUG : 强制 git HTTPS 重定向 ==="
55+ - git config --system url."https://github.com/".insteadOf "git@github.com:"
56+ - git config --system url."https://".insteadOf "ssh://git@github.com/"
57+ - git config --system url."https://".insteadOf "git://github.com/"
58+ - git config --system --add core.askPass /bin/true # 避免任何 git 交互
59+ - git config --system --list | grep url || echo "Git url redirect not set"
60+
61+ # DEBUG: 环境和路径
6262 - echo "=== DEBUG : Node & npm 检查 ==="
63- - which node || echo "node not found"
64- - node --version || echo "node version failed"
65- - which npm || echo "npm not found"
66- - npm --version || echo "npm version failed"
63+ - which node && node --version || echo "node failed"
64+ - which npm && npm --version || echo "npm failed"
6765
68- - echo "=== DEBUG : 当前缓存目录检查 ==="
69- - ls -la /run/build/02Engine/npm-cache || echo "npm cache dir not found"
66+ - echo "=== DEBUG : 当前缓存目录 ==="
67+ - ls -la /run/build/02Engine/npm-cache || echo "npm cache not found"
7068 - du -sh /run/build/02Engine/npm-cache || echo "cache size unknown"
71- - find /run/build/02Engine/npm-cache -type f | wc -l || echo "no files in cache"
69+ - find /run/build/02Engine/npm-cache -type f | wc -l || echo "no cache files "
7270
73- - echo "=== DEBUG : 当前目录内容 ==="
71+ - echo "=== DEBUG : 当前目录 ==="
7472 - ls -la
7573
76- - echo "=== DEBUG : package-lock.json 检查 ==="
77- - ls -l package-lock.json || echo "package-lock.json missing"
78- - head -n 20 package-lock.json || echo "cannot read package-lock.json "
74+ - echo "=== DEBUG : package-lock.json ==="
75+ - ls -l package-lock.json || echo "lockfile missing"
76+ - head -n 20 package-lock.json || echo "cannot read lockfile "
7977
80- # ──────────────────────────────── 离线安装依赖 ────────────────────────────────
81- - npm ci --prefer-offline --offline --no-audit --no-fund --ignore-scripts --legacy-peer-deps --force --no-package-lock || npm install --prefer-offline --offline --no-audit --no-fund --ignore-scripts --legacy-peer-deps --force
78+ # 离线安装(加 --no-git-tags 以避免 git 操作)
79+ - npm ci --prefer-offline --offline --no-audit --no-fund --ignore-scripts --legacy-peer-deps --force --no-package-lock --no-git-tags || npm install --prefer-offline --offline --no-audit --no-fund --ignore-scripts --legacy-peer-deps --force --no-git-tags
8280
83- # 输出 npm 详细日志(如果失败,方便定位)
84- - find /run/build/02Engine/npm-cache -name "*-debug-*.log" -exec cat {} \; || echo "No npm debug log found "
81+ # 输出日志
82+ - find /run/build/02Engine/npm-cache -name "*-debug-*.log" -exec cat {} \; || echo "No npm log"
8583
86- # 后续构建步骤
84+ # 后续
8785 - npm run fetch || true
8886 - npm run webpack:prod
8987 - npm run release-automation/build.js --linux-dir --x64
9088
9189 - mkdir -p /app/main
92- - cp -a dist/linux-unpacked/* /app/main/ || echo "dist/linux-unpacked not found"
90+ - cp -a dist/linux-unpacked/* /app/main/ || echo "dist not found"
9391
9492 - install -Dm644 icon.png /app/share/icons/hicolor/512x512/apps/io.github._02engine._02Engine.png
9593
0 commit comments