From ab614fce9fc1252de8971c84081baedd89b44c7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=90=E6=AE=87?= Date: Sat, 21 Dec 2024 20:13:44 +0800 Subject: [PATCH] 1.5.13 --- .github/workflows/build.yml | 182 ++++-------------- package.json | 2 +- scripts/updater.mjs | 2 +- src/main/resolve/autoUpdater.ts | 4 +- .../connections/connection-detail-modal.tsx | 4 +- .../src/components/updater/updater-modal.tsx | 2 +- src/renderer/src/pages/settings.tsx | 2 +- 7 files changed, 42 insertions(+), 156 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 62c9e04a..2044364f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,11 @@ name: Build +permissions: write-all on: + workflow_dispatch: + inputs: + version: + description: "Tag version to release" + required: false push: branches: - master @@ -10,167 +16,48 @@ on: - '.github/ISSUE_TEMPLATE/**' - '.github/workflows/issues.yml' -permissions: write-all - jobs: - windows: + build: strategy: fail-fast: false matrix: - arch: - - x64 - - ia32 - - arm64 - runs-on: windows-latest + os: [windows-latest, ubuntu-latest, macos-latest] + arch: [x64, arm64] + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm - run: npm install -g pnpm - - name: Install Dependencies - env: - npm_config_arch: ${{ matrix.arch }} - npm_config_target_arch: ${{ matrix.arch }} - run: | - pnpm install - pnpm add @mihomo-party/sysproxy-win32-${{ matrix.arch }}-msvc - pnpm prepare --${{ matrix.arch }} - - name: Build - env: - npm_config_arch: ${{ matrix.arch }} - npm_config_target_arch: ${{ matrix.arch }} - run: pnpm build:win --${{ matrix.arch }} - - name: Add Portable Flag - run: | - New-Item -Path "PORTABLE" -ItemType File - Get-ChildItem dist/*portable.7z | ForEach-Object { - 7z a $_.FullName PORTABLE - } - - name: Generate checksums - run: pnpm checksum setup.exe portable.7z - - name: Upload Artifacts - if: startsWith(github.ref, 'refs/heads/') - uses: actions/upload-artifact@v4 - with: - name: Windows ${{ matrix.arch }} - path: | - dist/*.sha256 - dist/*setup.exe - dist/*portable.7z - if-no-files-found: error - - name: Publish Release - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v2 - with: - files: | - dist/*.sha256 - dist/*setup.exe - dist/*portable.7z - body_path: changelog.md - token: ${{ secrets.GITHUB_TOKEN }} - linux: - strategy: - fail-fast: false - matrix: - arch: - - x64 - - arm64 - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - name: Setup pnpm run: npm install -g pnpm - - name: Install Dependencies - env: - npm_config_arch: ${{ matrix.arch }} - npm_config_target_arch: ${{ matrix.arch }} - run: | - pnpm install - pnpm add @mihomo-party/sysproxy-linux-${{ matrix.arch }}-gnu - sed -i "s/productName: Mihomo Party/productName: mihomo-party/" electron-builder.yml - pnpm prepare --${{ matrix.arch }} - - name: Build - env: - npm_config_arch: ${{ matrix.arch }} - npm_config_target_arch: ${{ matrix.arch }} - run: pnpm build:linux --${{ matrix.arch }} - - name: Generate checksums - run: pnpm checksum .deb .rpm - - name: Upload Artifacts - if: startsWith(github.ref, 'refs/heads/') - uses: actions/upload-artifact@v4 - with: - name: Linux ${{ matrix.arch }} - path: | - dist/*.sha256 - dist/*.deb - dist/*.rpm - if-no-files-found: error - - name: Publish Release - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v2 - with: - files: | - dist/*.sha256 - dist/*.deb - dist/*.rpm - body_path: changelog.md - token: ${{ secrets.GITHUB_TOKEN }} - macos: - strategy: - fail-fast: false - matrix: - arch: - - x64 - - arm64 - runs-on: macos-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup pnpm - run: npm install -g pnpm - - name: Install Dependencies + - name: Install Dependencies and Prepare env: npm_config_arch: ${{ matrix.arch }} npm_config_target_arch: ${{ matrix.arch }} run: | pnpm install - pnpm add @mihomo-party/sysproxy-darwin-${{ matrix.arch }} + pnpm add @mihomo-party/sysproxy-${{ matrix.os == 'windows-latest' && 'win32' || matrix.os == 'ubuntu-latest' && 'linux' || 'darwin' }}-${{ matrix.arch }}${{ matrix.os == 'ubuntu-latest' && '-gnu' || matrix.os == 'windows-latest' && '-msvc' || '' }} pnpm prepare --${{ matrix.arch }} + - name: Build env: npm_config_arch: ${{ matrix.arch }} npm_config_target_arch: ${{ matrix.arch }} run: | - chmod +x build/pkg-scripts/postinstall - pnpm build:mac --${{ matrix.arch }} - - name: Generate checksums - run: pnpm checksum .pkg + pnpm build:${{ matrix.os == 'windows-latest' && 'win' || matrix.os == 'ubuntu-latest' && 'linux' || 'mac' }} --${{ matrix.arch }} + - name: Upload Artifacts if: startsWith(github.ref, 'refs/heads/') uses: actions/upload-artifact@v4 with: - name: MacOS ${{ matrix.arch }} - path: | - dist/*.sha256 - dist/*.pkg + name: ${{ matrix.os }} ${{ matrix.arch }} + path: dist/* if-no-files-found: error - - name: Publish Release - if: startsWith(github.ref, 'refs/tags/v') - uses: softprops/action-gh-release@v2 - with: - files: | - dist/*.sha256 - dist/*.pkg - body_path: changelog.md - token: ${{ secrets.GITHUB_TOKEN }} - artifact: - if: startsWith(github.ref, 'refs/heads/') - needs: [windows, linux, macos] + pre-release: + if: startsWith(github.ref, 'refs/heads/') || ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version == '' }} + needs: [build] runs-on: ubuntu-latest concurrency: group: artifact @@ -182,8 +69,8 @@ jobs: path: bin/ merge-multiple: true - - name: Upload Prerelease - uses: softprops/action-gh-release@v1 + - name: Publish Prerelease + uses: softprops/action-gh-release@v2 if: ${{ success() }} with: tag_name: pre-release @@ -191,22 +78,21 @@ jobs: bin/* prerelease: true - updater: - if: startsWith(github.ref, 'refs/tags/v') - needs: [windows, macos, linux] + release: + if: startsWith(github.ref, 'refs/tags/v') || ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version != '' }} + needs: [build] runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup pnpm - run: npm install -g pnpm - - name: Install Dependencies - run: pnpm install - - name: Generate latest.yml - run: pnpm updater + - uses: actions/download-artifact@v4 + with: + path: bin/ + merge-multiple: true + - name: Publish Release uses: softprops/action-gh-release@v2 with: - files: latest.yml - body_path: changelog.md + tag_name: ${{ github.event.inputs.version != '' && github.event.inputs.version || github.ref }} + files: | + latest.yml + bin/* token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index dc2e9e34..98baca3c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mihomo-party", - "version": "1.5.12", + "version": "1.5.13", "description": "Mihomo Party", "main": "./out/main/index.js", "author": "mihomo-party-org", diff --git a/scripts/updater.mjs b/scripts/updater.mjs index fcfd1b5b..075c3178 100644 --- a/scripts/updater.mjs +++ b/scripts/updater.mjs @@ -4,7 +4,7 @@ import { readFileSync, writeFileSync } from 'fs' const pkg = readFileSync('package.json', 'utf-8') let 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}` +const downloadUrl = `https://github.com/xishang0128/mihomo-party/releases/download/v${version}` const latest = { version, changelog diff --git a/src/main/resolve/autoUpdater.ts b/src/main/resolve/autoUpdater.ts index b1a1cb1a..7e900204 100644 --- a/src/main/resolve/autoUpdater.ts +++ b/src/main/resolve/autoUpdater.ts @@ -13,7 +13,7 @@ import { promisify } from 'util' export async function checkUpdate(): Promise { const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig() const res = await axios.get( - 'https://github.com/mihomo-party-org/mihomo-party/releases/latest/download/latest.yml', + 'https://github.com/xishang0128/mihomo-party/releases/latest/download/latest.yml', { headers: { 'Content-Type': 'application/octet-stream' }, proxy: { @@ -35,7 +35,7 @@ export async function checkUpdate(): Promise { export async function downloadAndInstallUpdate(version: string): Promise { const { 'mixed-port': mixedPort = 7890 } = await getControledMihomoConfig() - const baseUrl = `https://github.com/mihomo-party-org/mihomo-party/releases/download/v${version}/` + const baseUrl = `https://github.com/xishang0128/mihomo-party/releases/download/v${version}/` const fileMap = { 'win32-x64': `mihomo-party-windows-${version}-x64-setup.exe`, 'win32-ia32': `mihomo-party-windows-${version}-ia32-setup.exe`, diff --git a/src/renderer/src/components/connections/connection-detail-modal.tsx b/src/renderer/src/components/connections/connection-detail-modal.tsx index b1096dd6..9dbbc384 100644 --- a/src/renderer/src/components/connections/connection-detail-modal.tsx +++ b/src/renderer/src/components/connections/connection-detail-modal.tsx @@ -135,8 +135,8 @@ const ConnectionDetailModal: React.FC = (props) => { {dayjs(connection.start).fromNow()} - {connection.rule} - {connection.rulePayload ? `(${connection.rulePayload})` : '未命中任何规则'} + {connection.rule ? connection.rule : '未命中任何规则'} + {connection.rulePayload ? `(${connection.rulePayload})` : ''} {[...connection.chains].reverse().join('>>')} {calcTraffic(connection.uploadSpeed || 0)}/s diff --git a/src/renderer/src/components/updater/updater-modal.tsx b/src/renderer/src/components/updater/updater-modal.tsx index 4f13c41b..446227f7 100644 --- a/src/renderer/src/components/updater/updater-modal.tsx +++ b/src/renderer/src/components/updater/updater-modal.tsx @@ -44,7 +44,7 @@ const UpdaterModal: React.FC = (props) => { size="sm" className="flex app-nodrag" onPress={() => { - open(`https://github.com/mihomo-party-org/mihomo-party/releases/tag/v${version}`) + open(`https://github.com/xishang0128/mihomo-party/releases/tag/v${version}`) }} > 前往下载 diff --git a/src/renderer/src/pages/settings.tsx b/src/renderer/src/pages/settings.tsx index 4dbe8f13..585b51dc 100644 --- a/src/renderer/src/pages/settings.tsx +++ b/src/renderer/src/pages/settings.tsx @@ -36,7 +36,7 @@ const Settings: React.FC = () => { className="app-nodrag" title="GitHub 仓库" onPress={() => { - window.open('https://github.com/mihomo-party-org/mihomo-party') + window.open('https://github.com/xishang0128/mihomo-party') }} >