mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
chore(workflow): update dev
This commit is contained in:
parent
f7716ae448
commit
84c89105b4
65
.github/workflows/build.yml
vendored
65
.github/workflows/build.yml
vendored
@ -20,26 +20,48 @@ jobs:
|
||||
continue-on-error: true
|
||||
run: |
|
||||
# Get release ID for dev tag
|
||||
echo "🔍 Looking for existing dev release..."
|
||||
RELEASE_ID=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/tags/dev" | \
|
||||
jq -r '.id // empty')
|
||||
|
||||
if [ ! -z "$RELEASE_ID" ]; then
|
||||
echo "Found dev release with ID: $RELEASE_ID"
|
||||
|
||||
# Get all assets and delete them
|
||||
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets" | \
|
||||
jq -r '.[].id' | \
|
||||
while read asset_id; do
|
||||
echo "Deleting asset: $asset_id"
|
||||
curl -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id"
|
||||
if [ ! -z "$RELEASE_ID" ] && [ "$RELEASE_ID" != "empty" ]; then
|
||||
echo "✅ Found dev release with ID: $RELEASE_ID"
|
||||
|
||||
# Get all assets
|
||||
echo "📋 Getting list of assets..."
|
||||
ASSETS=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/$RELEASE_ID/assets")
|
||||
|
||||
ASSET_COUNT=$(echo "$ASSETS" | jq '. | length')
|
||||
echo "📦 Found $ASSET_COUNT assets to delete"
|
||||
|
||||
if [ "$ASSET_COUNT" -gt 0 ]; then
|
||||
# Delete each asset with detailed logging
|
||||
echo "$ASSETS" | jq -r '.[].id' | while read asset_id; do
|
||||
if [ ! -z "$asset_id" ]; then
|
||||
echo "🗑️ Deleting asset ID: $asset_id"
|
||||
RESPONSE=$(curl -s -w "HTTPSTATUS:%{http_code}" -X DELETE \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
"https://api.github.com/repos/${{ github.repository }}/releases/assets/$asset_id")
|
||||
|
||||
HTTP_CODE=$(echo $RESPONSE | tr -d '\n' | sed -e 's/.*HTTPSTATUS://')
|
||||
if [ "$HTTP_CODE" = "204" ]; then
|
||||
echo "✅ Successfully deleted asset $asset_id"
|
||||
else
|
||||
echo "❌ Failed to delete asset $asset_id (HTTP: $HTTP_CODE)"
|
||||
echo "Response: $(echo $RESPONSE | sed -e 's/HTTPSTATUS:.*//')"
|
||||
fi
|
||||
# Add small delay to avoid rate limiting
|
||||
sleep 0.5
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All dev release assets deleted"
|
||||
echo "🎉 Finished deleting assets"
|
||||
else
|
||||
echo "ℹ️ No assets found to delete"
|
||||
fi
|
||||
else
|
||||
echo "No existing dev release found"
|
||||
echo "ℹ️ No existing dev release found"
|
||||
fi
|
||||
- name: Skip for Tag Release
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
@ -109,7 +131,6 @@ jobs:
|
||||
dist/*.sha256
|
||||
dist/*setup.exe
|
||||
dist/*portable.7z
|
||||
body: "Development build from ${{ github.sha }}"
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -180,7 +201,6 @@ jobs:
|
||||
dist/*.sha256
|
||||
dist/*setup.exe
|
||||
dist/*portable.7z
|
||||
body: "Development build from ${{ github.sha }}"
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -244,7 +264,6 @@ jobs:
|
||||
dist/*.sha256
|
||||
dist/*.deb
|
||||
dist/*.rpm
|
||||
body: "Development build from ${{ github.sha }}"
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -330,7 +349,6 @@ jobs:
|
||||
files: |
|
||||
dist/*.sha256
|
||||
dist/*.pkg
|
||||
body: "Development build from ${{ github.sha }}"
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -418,7 +436,6 @@ jobs:
|
||||
files: |
|
||||
dist/*.sha256
|
||||
dist/*.pkg
|
||||
body: "Development build from ${{ github.sha }}"
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
@ -438,7 +455,15 @@ jobs:
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
RELEASE_TYPE: release
|
||||
run: pnpm telegram
|
||||
- name: Telegram Dev Notification
|
||||
if: github.event_name == 'workflow_dispatch'
|
||||
env:
|
||||
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
|
||||
GITHUB_SHA: ${{ github.sha }}
|
||||
RELEASE_TYPE: dev
|
||||
run: pnpm telegram:dev
|
||||
- name: Generate latest.yml
|
||||
run: pnpm updater
|
||||
- name: Publish Release
|
||||
@ -454,7 +479,7 @@ jobs:
|
||||
with:
|
||||
tag_name: dev
|
||||
files: latest.yml
|
||||
body: "Development build updater from ${{ github.sha }}"
|
||||
body_path: changelog.md
|
||||
prerelease: true
|
||||
draft: false
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
23
changelog.md
23
changelog.md
@ -1,3 +1,11 @@
|
||||
## 1.8.6-dev
|
||||
|
||||
### 新功能 (Feat)
|
||||
- 增加硬件加速开关,解决某些显卡驱动问题导致的渲染异常或崩溃
|
||||
|
||||
### 修复 (Fix)
|
||||
- 修复windows 下以非管理员模式启动后,无法自动更新的权限问题
|
||||
|
||||
## 1.8.5
|
||||
|
||||
**🎉 本次更新增加了大家期待已久的托盘图标根据代理状态变化颜色,系统代理为蓝色,虚拟网卡为绿色,双开为红色
|
||||
@ -34,17 +42,4 @@
|
||||
### 修复 (Fix)
|
||||
- 修复某些系统下的悬浮窗开启崩溃的问题(开启兼容模式=关闭硬件加速)
|
||||
- 开机自启在非管理员模式下报错的问题
|
||||
- 解决某些 macos 系统下无法开启虚拟网卡的问题(tun device名称冲突)
|
||||
|
||||
## 1.8.3
|
||||
**本次更新移除了 Windows 下启动必须管理员模式的机制,改为只在启用虚拟网卡模式的时候,申请 UAC 权限重启软件,安全性更好,更灵活,给无法使用管理员模式运行软件的企业用户提供了更大的便利**
|
||||
|
||||
### 新功能 (Feat)
|
||||
- 移除 Windows 下启动必须管理员模式的机制,改为只在启用虚拟网卡模式的时候,申请 UAC 权限重启软件
|
||||
|
||||
### 重构 (Refactor)
|
||||
- Geodata 文件只有在源文件更新的时候才会在启动时覆盖更新
|
||||
|
||||
### 修复 (Fix)
|
||||
- 修复 DNS/嗅探覆写开关逻辑,修改设置不再会直接写入运行时配置,增加了“仅保存”按钮
|
||||
- 悬浮窗改为纯矩形,修复 windows 下兼容性问题带来的白边
|
||||
- 解决某些 macos 系统下无法开启虚拟网卡的问题(tun device名称冲突)
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "mihomo-party",
|
||||
"version": "1.8.5",
|
||||
"version": "1.8.6-dev",
|
||||
"description": "Mihomo Party",
|
||||
"main": "./out/main/index.js",
|
||||
"author": "mihomo-party-org",
|
||||
@ -14,7 +14,8 @@
|
||||
"prepare": "node scripts/prepare.mjs",
|
||||
"updater": "node scripts/updater.mjs",
|
||||
"checksum": "node scripts/checksum.mjs",
|
||||
"telegram": "node scripts/telegram.mjs",
|
||||
"telegram": "node scripts/telegram.mjs release",
|
||||
"telegram:dev": "node scripts/telegram.mjs dev",
|
||||
"artifact": "node scripts/artifact.mjs",
|
||||
"dev": "electron-vite dev",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
|
||||
@ -5,18 +5,64 @@ const chat_id = '@MihomoPartyChannel'
|
||||
const pkg = readFileSync('package.json', 'utf-8')
|
||||
const changelog = readFileSync('changelog.md', 'utf-8')
|
||||
const { version } = JSON.parse(pkg)
|
||||
const downloadUrl = `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}`
|
||||
let content = `<b>🌟 <a href="https://github.com/mihomo-party-org/mihomo-party/releases/tag/v${version}">Mihomo Party v${version}</a> 正式发布</b>\n\n`
|
||||
for (const line of changelog.split('\n')) {
|
||||
if (line.length === 0) {
|
||||
content += '\n'
|
||||
} else if (line.startsWith('### ')) {
|
||||
content += `<b>${line.replace('### ', '')}</b>\n`
|
||||
} else {
|
||||
content += `${line}\n`
|
||||
}
|
||||
|
||||
const releaseType = process.env.RELEASE_TYPE || process.argv[2] || 'release'
|
||||
const isDevRelease = releaseType === 'dev'
|
||||
|
||||
function convertMarkdownToTelegramHTML(content) {
|
||||
return content
|
||||
.split("\n")
|
||||
.map((line) => {
|
||||
if (line.trim().length === 0) {
|
||||
return "";
|
||||
} else if (line.startsWith("## ")) {
|
||||
return `<b>${line.replace("## ", "")}</b>`;
|
||||
} else if (line.startsWith("### ")) {
|
||||
return `<b>${line.replace("### ", "")}</b>`;
|
||||
} else if (line.startsWith("#### ")) {
|
||||
return `<b>${line.replace("#### ", "")}</b>`;
|
||||
} else {
|
||||
let processedLine = line.replace(
|
||||
/\[([^\]]+)\]\(([^)]+)\)/g,
|
||||
(match, text, url) => {
|
||||
const encodedUrl = encodeURI(url);
|
||||
return `<a href="${encodedUrl}">${text}</a>`;
|
||||
},
|
||||
);
|
||||
processedLine = processedLine.replace(
|
||||
/\*\*([^*]+)\*\*/g,
|
||||
"<b>$1</b>",
|
||||
);
|
||||
return processedLine;
|
||||
}
|
||||
})
|
||||
.join("\n");
|
||||
}
|
||||
|
||||
let content = '';
|
||||
|
||||
if (isDevRelease) {
|
||||
|
||||
const commitSha = process.env.GITHUB_SHA || 'unknown'
|
||||
const shortCommitSha = commitSha.substring(0, 7)
|
||||
|
||||
content = `<b>🚧 <a href="https://github.com/mihomo-party-org/mihomo-party/releases/tag/dev">Mihomo Party Dev Build</a> 开发版本发布</b>\n\n`
|
||||
content += `<b>基于版本:</b> ${version}\n`
|
||||
content += `<b>提交哈希:</b> <a href="https://github.com/mihomo-party-org/mihomo-party/commit/${commitSha}">${shortCommitSha}</a>\n\n`
|
||||
content += `<b>更新日志:</b>\n`
|
||||
content += convertMarkdownToTelegramHTML(changelog)
|
||||
content += '\n\n<b>⚠️ 注意:这是开发版本,可能存在不稳定性,仅供测试使用</b>\n'
|
||||
} else {
|
||||
// 正式版本通知
|
||||
content = `<b>🌟 <a href="https://github.com/mihomo-party-org/mihomo-party/releases/tag/v${version}">Mihomo Party v${version}</a> 正式发布</b>\n\n`
|
||||
content += convertMarkdownToTelegramHTML(changelog)
|
||||
}
|
||||
|
||||
// 构建下载链接
|
||||
const downloadUrl = isDevRelease
|
||||
? `https://github.com/mihomo-party-org/mihomo-party/releases/download/dev`
|
||||
: `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}`
|
||||
|
||||
content += '\n<b>下载地址:</b>\n<b>Windows10/11:</b>\n'
|
||||
content += `安装版:<a href="${downloadUrl}/mihomo-party-windows-${version}-x64-setup.exe">64位</a> | <a href="${downloadUrl}/mihomo-party-windows-${version}-ia32-setup.exe">32位</a> | <a href="${downloadUrl}/mihomo-party-windows-${version}-arm64-setup.exe">ARM64</a>\n`
|
||||
content += `便携版:<a href="${downloadUrl}/mihomo-party-windows-${version}-x64-portable.7z">64位</a> | <a href="${downloadUrl}/mihomo-party-windows-${version}-ia32-portable.7z">32位</a> | <a href="${downloadUrl}/mihomo-party-windows-${version}-arm64-portable.7z">ARM64</a>\n`
|
||||
@ -44,3 +90,5 @@ await axios.post(`https://api.telegram.org/bot${process.env.TELEGRAM_BOT_TOKEN}/
|
||||
},
|
||||
parse_mode: 'HTML'
|
||||
})
|
||||
|
||||
console.log(`${isDevRelease ? '开发版本' : '正式版本'}Telegram 通知发送成功`)
|
||||
Loading…
x
Reference in New Issue
Block a user