ci: use domestic PyPI mirrors for PyArmor cross-platform pip installs

Made-with: Cursor
This commit is contained in:
2026-04-06 13:15:56 +08:00
parent 7fdd481c60
commit 312e7ede63

View File

@@ -24,7 +24,7 @@ on:
type: string type: string
default: https://jc2009.com/api/artifacts/prune-old-versions default: https://jc2009.com/api/artifacts/prune-old-versions
secrets: secrets:
# Base64 of official pyarmor-regfile-*.zip — trial mode still allows only one obfuscated script per CI run. # Base64 of official pyarmor-regfile-*.zip — optional; without it, PyArmor trial applies (e.g. large per-file code limits).
PYARMOR_REG_B64: PYARMOR_REG_B64:
required: false required: false
@@ -35,19 +35,25 @@ jobs:
ARTIFACT_PLATFORM: ${{ inputs.artifact_platform }} ARTIFACT_PLATFORM: ${{ inputs.artifact_platform }}
PYARMOR_PLATFORM: ${{ inputs.pyarmor_platform }} PYARMOR_PLATFORM: ${{ inputs.pyarmor_platform }}
PIP_BREAK_SYSTEM_PACKAGES: "1" PIP_BREAK_SYSTEM_PACKAGES: "1"
# PyArmor 交叉平台加密时会内部执行 pip 安装 pyarmor.cli.core.* 等包;不设则默认走 files.pythonhosted.org国内 CI 易超时。
PIP_INDEX_URL: https://pypi.tuna.tsinghua.edu.cn/simple
PIP_EXTRA_INDEX_URL: https://mirrors.aliyun.com/pypi/simple https://mirrors.cloud.tencent.com/pypi/simple https://mirrors.huaweicloud.com/repository/pypi/simple
PIP_DEFAULT_TIMEOUT: "180"
PIP_TRUSTED_HOST: pypi.tuna.tsinghua.edu.cn mirrors.aliyun.com mirrors.cloud.tencent.com mirrors.huaweicloud.com files.pythonhosted.org pypi.org
steps: steps:
- uses: http://120.25.191.12:3000/admin/actions-checkout@v4 - uses: http://120.25.191.12:3000/admin/actions-checkout@v4
# Pin PyArmor 8.5.3 — matches desktop bundles; 9.x trial is stricter in CI. # Pin PyArmor 8.5.3 — matches desktop bundles; 9.x trial is stricter in CI
# 镜像由 job envPIP_INDEX_URL / PIP_EXTRA_INDEX_URL统一指定与 Encrypt 步骤中 PyArmor 内部 pip 一致。
- name: Setup Tools - name: Setup Tools
run: pip install "pyarmor==8.5.3" requests python-frontmatter --break-system-packages -i https://pypi.tuna.tsinghua.edu.cn/simple run: pip install "pyarmor==8.5.3" requests python-frontmatter --break-system-packages
- name: Register PyArmor (optional) - name: Register PyArmor (optional)
env: env:
PYARMOR_REG_B64: ${{ secrets.PYARMOR_REG_B64 }} PYARMOR_REG_B64: ${{ secrets.PYARMOR_REG_B64 }}
run: | run: |
if [ -z "${PYARMOR_REG_B64}" ]; then if [ -z "${PYARMOR_REG_B64}" ]; then
echo "PyArmor: no PYARMOR_REG_B64 secret — trial mode (fails if scripts/*.py has more than one file)." echo "PyArmor: no PYARMOR_REG_B64 secret — trial mode (very large single .py modules may fail to obfuscate)."
else else
python -c "import os,base64,pathlib,subprocess; p=pathlib.Path('/tmp/pyarmor-reg.zip'); p.write_bytes(base64.standard_b64decode(os.environ['PYARMOR_REG_B64'])); subprocess.run(['pyarmor','reg',str(p)],check=True); p.unlink(missing_ok=True)" python -c "import os,base64,pathlib,subprocess; p=pathlib.Path('/tmp/pyarmor-reg.zip'); p.write_bytes(base64.standard_b64decode(os.environ['PYARMOR_REG_B64'])); subprocess.run(['pyarmor','reg',str(p)],check=True); p.unlink(missing_ok=True)"
fi fi