This repository has been archived by the owner on Mar 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fa40797
commit 0579ef6
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env node | ||
|
||
const fs = require('fs'); | ||
const yaml = require('yaml'); | ||
const { version } = require('../package.json'); | ||
const { execSync } = require('child_process'); | ||
const path = require('path'); | ||
|
||
const oss = ['mac', 'win']; | ||
const arches = ['x64', 'arm64']; | ||
const exts = ['exe', 'dmg']; | ||
|
||
const latest = { | ||
version, | ||
files: [], | ||
releaseDate: new Date().toISOString(), | ||
}; | ||
|
||
for (let os of oss) { | ||
for (let arch of arches) { | ||
for (let ext of exts) { | ||
const artifactName = `wallet3-${os}-${arch}-${version}.${ext}`; | ||
|
||
const pkg = path.join(__dirname, '..', 'dist', artifactName); | ||
|
||
let size = 0; | ||
try { | ||
size = fs.statSync(pkg).size; | ||
} catch (error) { | ||
continue; | ||
} | ||
|
||
const checksum = execSync(`shasum -a 512 ${pkg}`).toString('utf-8').split(' ')[0]; | ||
|
||
latest.files.push({ url: artifactName, sha512: checksum, size }); | ||
} | ||
} | ||
} | ||
|
||
const result = yaml.stringify(latest); | ||
console.log(result); | ||
fs.writeFileSync(path.join(__dirname, '..', 'dist', 'latest.yml'), result); |