fix: deploy script
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
#!/usr/bin/env zx
|
||||
/* eslint-disable */
|
||||
// @ts-check
|
||||
|
||||
function getOsBuildAssetName() {
|
||||
const platform = process.platform
|
||||
const kernelMap = {
|
||||
darwin: 'macos',
|
||||
linux: 'linux',
|
||||
win32: 'windows',
|
||||
}
|
||||
const os = kernelMap[platform]
|
||||
if (!os) {
|
||||
throw new Error('No current platform build. Please build manually')
|
||||
}
|
||||
return `release-${os}-latest.zip`
|
||||
}
|
||||
|
||||
const PKG = require('../package.json')
|
||||
async function main() {
|
||||
const res = await fetch(
|
||||
`https://api.github.com/repos/${PKG.repository.directory}/releases/latest`,
|
||||
)
|
||||
const data = await res.json()
|
||||
const downloadUrl = data.assets.find(
|
||||
(asset) =>
|
||||
asset.name === 'release-ubuntu.zip' || asset.name === 'release.zip',
|
||||
const downloadUrl = data.assets.find((asset) =>
|
||||
[getOsBuildAssetName(), 'release.zip'].includes(asset.name),
|
||||
)?.browser_download_url
|
||||
if (!downloadUrl) {
|
||||
throw new Error('no download url found')
|
||||
|
||||
Reference in New Issue
Block a user