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_arch: ${{ matrix.arch }}
|
||||||
npm_config_target_arch: ${{ matrix.arch }}
|
npm_config_target_arch: ${{ matrix.arch }}
|
||||||
run: pnpm build:win --${{ matrix.arch }}
|
run: pnpm build:win --${{ matrix.arch }}
|
||||||
|
- name: Generate checksums
|
||||||
|
run: pnpm checksum setup.exe portable.7z
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
if: startsWith(github.ref, 'refs/heads/')
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Windows ${{ matrix.arch }}
|
name: Windows ${{ matrix.arch }}
|
||||||
path: |
|
path: |
|
||||||
|
dist/*.sha256
|
||||||
dist/*setup.exe
|
dist/*setup.exe
|
||||||
dist/*portable.7z
|
dist/*portable.7z
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
@ -97,12 +100,15 @@ jobs:
|
||||||
npm_config_arch: ${{ matrix.arch }}
|
npm_config_arch: ${{ matrix.arch }}
|
||||||
npm_config_target_arch: ${{ matrix.arch }}
|
npm_config_target_arch: ${{ matrix.arch }}
|
||||||
run: pnpm build:linux --${{ matrix.arch }}
|
run: pnpm build:linux --${{ matrix.arch }}
|
||||||
|
- name: Generate checksums
|
||||||
|
run: pnpm checksum .deb .rpm
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
if: startsWith(github.ref, 'refs/heads/')
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: Linux ${{ matrix.arch }}
|
name: Linux ${{ matrix.arch }}
|
||||||
path: |
|
path: |
|
||||||
|
dist/*.sha256
|
||||||
dist/*.deb
|
dist/*.deb
|
||||||
dist/*.rpm
|
dist/*.rpm
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
@ -150,18 +156,24 @@ jobs:
|
||||||
npm_config_arch: ${{ matrix.arch }}
|
npm_config_arch: ${{ matrix.arch }}
|
||||||
npm_config_target_arch: ${{ matrix.arch }}
|
npm_config_target_arch: ${{ matrix.arch }}
|
||||||
run: pnpm build:mac --${{ matrix.arch }}
|
run: pnpm build:mac --${{ matrix.arch }}
|
||||||
|
- name: Generate checksums
|
||||||
|
run: pnpm checksum .dmg
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
if: startsWith(github.ref, 'refs/heads/')
|
if: startsWith(github.ref, 'refs/heads/')
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: MacOS ${{ matrix.arch }}
|
name: MacOS ${{ matrix.arch }}
|
||||||
path: dist/*.dmg
|
path: |
|
||||||
|
dist/*.sha256
|
||||||
|
dist/*.dmg
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
- name: Publish Release
|
- name: Publish Release
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: dist/*.dmg
|
files: |
|
||||||
|
*.sha256
|
||||||
|
dist/*.dmg
|
||||||
body_path: changelog.md
|
body_path: changelog.md
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
"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",
|
"updater": "node scripts/updater.mjs",
|
||||||
|
"checksum": "node scripts/checksum.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 --publish never --win",
|
"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