mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
custom release
This commit is contained in:
parent
acc9650d42
commit
40f6c478b5
67
.github/workflows/build.yml
vendored
67
.github/workflows/build.yml
vendored
@ -3,6 +3,9 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
tags:
|
||||||
|
- v*
|
||||||
|
|
||||||
permissions: write-all
|
permissions: write-all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@ -33,16 +36,30 @@ jobs:
|
|||||||
pnpm install
|
pnpm install
|
||||||
pnpm prepare --${{ matrix.arch }}
|
pnpm prepare --${{ matrix.arch }}
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: pnpm build:win --${{ matrix.arch }}
|
run: pnpm build:win --${{ matrix.arch }}
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Windows ${{ matrix.arch }}
|
name: Windows ${{ matrix.arch }}
|
||||||
path: dist/*.exe
|
path: dist/*.exe
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dist/*.exe
|
||||||
|
dist/*.blockmap
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Merge Yaml
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: pnpm updater latest.yml
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: dist/latest.yml
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
linux:
|
linux:
|
||||||
strategy:
|
strategy:
|
||||||
@ -70,10 +87,7 @@ jobs:
|
|||||||
pnpm install
|
pnpm install
|
||||||
pnpm prepare --${{ matrix.arch }}
|
pnpm prepare --${{ matrix.arch }}
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: pnpm build:linux --${{ matrix.arch }}
|
run: pnpm build:linux --${{ matrix.arch }}
|
||||||
|
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -82,6 +96,29 @@ jobs:
|
|||||||
dist/*.deb
|
dist/*.deb
|
||||||
dist/*.rpm
|
dist/*.rpm
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dist/*.deb
|
||||||
|
dist/*.rpm
|
||||||
|
dist/*.blockmap
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Merge Yaml
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v') && matrix.arch == 'x64'
|
||||||
|
run: pnpm updater latest-linux.yml
|
||||||
|
- name: Merge Yaml
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v') && matrix.arch == 'arm64'
|
||||||
|
run: pnpm updater latest-linux-arm64.yml
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dist/latest-linux.yml
|
||||||
|
dist/latest-linux-arm64.yml
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
macos:
|
macos:
|
||||||
strategy:
|
strategy:
|
||||||
@ -119,3 +156,21 @@ jobs:
|
|||||||
name: MacOS ${{ matrix.arch }}
|
name: MacOS ${{ matrix.arch }}
|
||||||
path: dist/*.dmg
|
path: dist/*.dmg
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
dist/*.dmg
|
||||||
|
dist/*.zip
|
||||||
|
dist/*.blockmap
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Merge Yaml
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
run: pnpm updater latest-mac.yml
|
||||||
|
- name: Publish Release
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: dist/latest-mac.yml
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
@ -54,7 +54,4 @@ linux:
|
|||||||
category: Utility
|
category: Utility
|
||||||
artifactName: ${name}-linux-${version}-${arch}.${ext}
|
artifactName: ${name}-linux-${version}-${arch}.${ext}
|
||||||
npmRebuild: false
|
npmRebuild: false
|
||||||
publish:
|
publish: []
|
||||||
provider: github
|
|
||||||
owner: pompurin404
|
|
||||||
repo: mihomo-party
|
|
||||||
|
|||||||
@ -12,11 +12,12 @@
|
|||||||
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
|
||||||
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
||||||
"prepare": "node scripts/prepare.mjs",
|
"prepare": "node scripts/prepare.mjs",
|
||||||
|
"updater": "node scripts/updater.mjs",
|
||||||
"dev": "electron-vite dev",
|
"dev": "electron-vite dev",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"build:win": "electron-vite build && electron-builder --win",
|
"build:win": "electron-vite build && electron-builder --win --publish never",
|
||||||
"build:mac": "electron-vite build && electron-builder --mac",
|
"build:mac": "electron-vite build && electron-builder --mac --publish never",
|
||||||
"build:linux": "electron-vite build && electron-builder --linux"
|
"build:linux": "electron-vite build && electron-builder --linux --publish never"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@electron-toolkit/preload": "^3.0.1",
|
"@electron-toolkit/preload": "^3.0.1",
|
||||||
|
|||||||
32
scripts/updater.mjs
Normal file
32
scripts/updater.mjs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/explicit-function-return-type */
|
||||||
|
import axios from 'axios'
|
||||||
|
import yaml from 'yaml'
|
||||||
|
import fs from 'fs'
|
||||||
|
|
||||||
|
let file = 'latest.yml'
|
||||||
|
if (process.argv.slice(2).length !== 0) {
|
||||||
|
file = process.argv.slice(2)[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
async function check() {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(
|
||||||
|
`https://github.com/pompurin404/mihomo-party/releases/latest/download/${file}`,
|
||||||
|
{
|
||||||
|
headers: { 'Content-Type': 'application/octet-stream' }
|
||||||
|
}
|
||||||
|
)
|
||||||
|
const remoteData = yaml.parse(res.data)
|
||||||
|
const currentData = yaml.parse(fs.readFileSync(`dist/${file}`, 'utf8'))
|
||||||
|
remoteData.files.push(...currentData.files)
|
||||||
|
remoteData.releaseDate = `${new Date().toISOString()}`
|
||||||
|
fs.writeFileSync(`dist/${file}`, yaml.stringify(remoteData))
|
||||||
|
} catch (error) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
check().catch((error) => {
|
||||||
|
console.error(error)
|
||||||
|
process.exit(0)
|
||||||
|
})
|
||||||
Loading…
x
Reference in New Issue
Block a user