diff --git a/.github/scripts/lib/comment.ts b/.github/scripts/lib/comment.ts index 0966c77ad..c669d0828 100644 --- a/.github/scripts/lib/comment.ts +++ b/.github/scripts/lib/comment.ts @@ -5,6 +5,9 @@ export const COMMENT_MARKER = ''; export const DOCKER_COMMENT_MARKER = ''; +// 默认代理前缀(加速中国大陆访问 GitHub Release) +export const PROXY_BASE = 'https://nclatest.znin.net'; + export type BuildStatus = 'success' | 'failure' | 'cancelled' | 'pending' | 'unknown'; export interface BuildTarget { @@ -183,6 +186,7 @@ export function generateResultComment ( // 添加快速安装命令 if (installInfo) { + const proxyInstallUrl = installInfo.installUrl.replace('https://github.com', PROXY_BASE); lines.push( '', '---', @@ -190,11 +194,11 @@ export function generateResultComment ( '## 🚀 快速安装 (Linux)', '', '```bash', - `curl -sSL ${installInfo.installUrl} | bash`, + `curl -sSL ${proxyInstallUrl} | bash`, '```', '', `> 📦 [查看 Release 页面](${installInfo.releaseUrl})`, - '> ⚠️ 此为 PR 测试版本,约 24 小时后会被自动清理。' + '> ⚠️ 此为 PR 测试版本,约 5 天后会被自动清理。' ); } else if (publishFailed) { lines.push( @@ -353,7 +357,7 @@ export function generateDockerResultComment ( `docker pull ${dockerImage}`, '```', '', - '> ⚠️ 此为 PR 测试镜像,保留 7 天后自动清理。' + '> ⚠️ 此为 PR 测试镜像,保留 5 天后自动清理。' ); } diff --git a/.github/scripts/pr-publish-release.ts b/.github/scripts/pr-publish-release.ts index 293ad3976..211171bc7 100644 --- a/.github/scripts/pr-publish-release.ts +++ b/.github/scripts/pr-publish-release.ts @@ -21,6 +21,7 @@ import { execSync } from 'node:child_process'; import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs'; import { join, basename, resolve } from 'node:path'; import { GitHubAPI, getEnv, setOutput } from './lib/github.ts'; +import { PROXY_BASE } from './lib/comment.ts'; interface AssetEntry { name: string; @@ -118,6 +119,7 @@ async function main (): Promise { } // ---- 创建 Release ---- + const proxyInstallUrl = `${downloadBase}/install.sh`.replace('https://github.com', PROXY_BASE); const releaseBody = [ `## NapCat PR #${prNumber} 测试版本`, '', @@ -128,10 +130,10 @@ async function main (): Promise { '### 快速安装 (Linux)', '', '```bash', - `curl -sSL ${downloadBase}/install.sh | bash`, + `curl -sSL ${proxyInstallUrl} | bash`, '```', '', - '> ⚠️ 此为 PR 测试版本,约 24 小时后会被自动清理。', + '> ⚠️ 此为 PR 测试版本,约 5 天后会被自动清理。', ].join('\n'); console.log('🚀 Creating release...');