feat: add proxy prefix to install URL, change TTL to 5 days
- comment.ts: Add PROXY_BASE constant (https://nclatest.znin.net); install curl command now uses proxy URL for CN users; '24小时' -> '5天'; Docker '7天' -> '5天' - pr-publish-release.ts: Import PROXY_BASE, use proxy URL in release body, '24小时' -> '5天'
This commit is contained in:
2 files changed
+11
-5
No files matched your search
@@ -5,6 +5,9 @@
|
|||||||
export const COMMENT_MARKER = '<!-- napcat-pr-build -->';
|
export const COMMENT_MARKER = '<!-- napcat-pr-build -->';
|
||||||
export const DOCKER_COMMENT_MARKER = '<!-- napcat-pr-docker -->';
|
export const DOCKER_COMMENT_MARKER = '<!-- napcat-pr-docker -->';
|
||||||
|
|
||||||
|
// 默认代理前缀(加速中国大陆访问 GitHub Release)
|
||||||
|
export const PROXY_BASE = 'https://nclatest.znin.net';
|
||||||
|
|
||||||
export type BuildStatus = 'success' | 'failure' | 'cancelled' | 'pending' | 'unknown';
|
export type BuildStatus = 'success' | 'failure' | 'cancelled' | 'pending' | 'unknown';
|
||||||
|
|
||||||
export interface BuildTarget {
|
export interface BuildTarget {
|
||||||
@@ -183,6 +186,7 @@ export function generateResultComment (
|
|||||||
|
|
||||||
// 添加快速安装命令
|
// 添加快速安装命令
|
||||||
if (installInfo) {
|
if (installInfo) {
|
||||||
|
const proxyInstallUrl = installInfo.installUrl.replace('https://github.com', PROXY_BASE);
|
||||||
lines.push(
|
lines.push(
|
||||||
'',
|
'',
|
||||||
'---',
|
'---',
|
||||||
@@ -190,11 +194,11 @@ export function generateResultComment (
|
|||||||
'## 🚀 快速安装 (Linux)',
|
'## 🚀 快速安装 (Linux)',
|
||||||
'',
|
'',
|
||||||
'```bash',
|
'```bash',
|
||||||
`curl -sSL ${installInfo.installUrl} | bash`,
|
`curl -sSL ${proxyInstallUrl} | bash`,
|
||||||
'```',
|
'```',
|
||||||
'',
|
'',
|
||||||
`> 📦 [查看 Release 页面](${installInfo.releaseUrl})`,
|
`> 📦 [查看 Release 页面](${installInfo.releaseUrl})`,
|
||||||
'> ⚠️ 此为 PR 测试版本,约 24 小时后会被自动清理。'
|
'> ⚠️ 此为 PR 测试版本,约 5 天后会被自动清理。'
|
||||||
);
|
);
|
||||||
} else if (publishFailed) {
|
} else if (publishFailed) {
|
||||||
lines.push(
|
lines.push(
|
||||||
@@ -353,7 +357,7 @@ export function generateDockerResultComment (
|
|||||||
`docker pull ${dockerImage}`,
|
`docker pull ${dockerImage}`,
|
||||||
'```',
|
'```',
|
||||||
'',
|
'',
|
||||||
'> ⚠️ 此为 PR 测试镜像,保留 7 天后自动清理。'
|
'> ⚠️ 此为 PR 测试镜像,保留 5 天后自动清理。'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import { execSync } from 'node:child_process';
|
|||||||
import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs';
|
import { existsSync, readFileSync, writeFileSync, mkdirSync, readdirSync } from 'node:fs';
|
||||||
import { join, basename, resolve } from 'node:path';
|
import { join, basename, resolve } from 'node:path';
|
||||||
import { GitHubAPI, getEnv, setOutput } from './lib/github.ts';
|
import { GitHubAPI, getEnv, setOutput } from './lib/github.ts';
|
||||||
|
import { PROXY_BASE } from './lib/comment.ts';
|
||||||
|
|
||||||
interface AssetEntry {
|
interface AssetEntry {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -118,6 +119,7 @@ async function main (): Promise<void> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---- 创建 Release ----
|
// ---- 创建 Release ----
|
||||||
|
const proxyInstallUrl = `${downloadBase}/install.sh`.replace('https://github.com', PROXY_BASE);
|
||||||
const releaseBody = [
|
const releaseBody = [
|
||||||
`## NapCat PR #${prNumber} 测试版本`,
|
`## NapCat PR #${prNumber} 测试版本`,
|
||||||
'',
|
'',
|
||||||
@@ -128,10 +130,10 @@ async function main (): Promise<void> {
|
|||||||
'### 快速安装 (Linux)',
|
'### 快速安装 (Linux)',
|
||||||
'',
|
'',
|
||||||
'```bash',
|
'```bash',
|
||||||
`curl -sSL ${downloadBase}/install.sh | bash`,
|
`curl -sSL ${proxyInstallUrl} | bash`,
|
||||||
'```',
|
'```',
|
||||||
'',
|
'',
|
||||||
'> ⚠️ 此为 PR 测试版本,约 24 小时后会被自动清理。',
|
'> ⚠️ 此为 PR 测试版本,约 5 天后会被自动清理。',
|
||||||
].join('\n');
|
].join('\n');
|
||||||
|
|
||||||
console.log('🚀 Creating release...');
|
console.log('🚀 Creating release...');
|
||||||
|
|||||||
Reference in new issue
Block a user