mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
add checksum
This commit is contained in:
parent
e4ec90e73a
commit
ba484070ae
16
.github/workflows/build.yml
vendored
16
.github/workflows/build.yml
vendored
|
@ -44,12 +44,15 @@ jobs:
|
|||
npm_config_arch: ${{ matrix.arch }}
|
||||
npm_config_target_arch: ${{ matrix.arch }}
|
||||
run: pnpm build:win --${{ matrix.arch }}
|
||||
- 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
|
||||
|
@ -97,12 +100,15 @@ jobs:
|
|||
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
|
||||
|
@ -150,18 +156,24 @@ jobs:
|
|||
npm_config_arch: ${{ matrix.arch }}
|
||||
npm_config_target_arch: ${{ matrix.arch }}
|
||||
run: pnpm build:mac --${{ matrix.arch }}
|
||||
- name: Generate checksums
|
||||
run: pnpm checksum .dmg
|
||||
- name: Upload Artifacts
|
||||
if: startsWith(github.ref, 'refs/heads/')
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: MacOS ${{ matrix.arch }}
|
||||
path: dist/*.dmg
|
||||
path: |
|
||||
dist/*.sha256
|
||||
dist/*.dmg
|
||||
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
|
||||
files: |
|
||||
*.sha256
|
||||
dist/*.dmg
|
||||
body_path: changelog.md
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
"typecheck": "npm run typecheck:node && npm run typecheck:web",
|
||||
"prepare": "node scripts/prepare.mjs",
|
||||
"updater": "node scripts/updater.mjs",
|
||||
"checksum": "node scripts/checksum.mjs",
|
||||
"dev": "electron-vite dev",
|
||||
"postinstall": "electron-builder install-app-deps",
|
||||
"build:win": "electron-vite build && electron-builder --publish never --win",
|
||||
|
|
13
scripts/checksum.mjs
Normal file
13
scripts/checksum.mjs
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { readFileSync, readdirSync, writeFileSync } from 'fs'
|
||||
import { createHash } from 'crypto'
|
||||
const files = readdirSync('dist')
|
||||
|
||||
for (const file of files) {
|
||||
for (const ext of process.argv.slice(2)) {
|
||||
if (file.endsWith(ext)) {
|
||||
const content = readFileSync(`dist/${file}`)
|
||||
const checksum = createHash('sha256').update(content, 'utf8').digest('hex')
|
||||
writeFileSync(`dist/${file}.sha256`, checksum)
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user