Download based on manifest.json

This commit is contained in:
Anton Medvedev 2021-10-24 17:26:47 +00:00 committed by GitHub
parent 732002f64c
commit 0d8e60c62d

@ -59,11 +59,22 @@ async function dep() {
console.log(`Downloading "https://deployer.org/deployer.phar".`)
execa.commandSync('curl -LO https://deployer.org/deployer.phar')
} else {
if (!/^v/.test(version)) {
version = 'v' + version
version = version.replace(/^v/, '')
let {stdout} = execa.commandSync(`curl -L https://deployer.org/manifest.json`)
let manifest = JSON.parse(stdout)
let url
for (let asset of manifest) {
if (asset.version === version) {
url = asset.url
break
}
}
if (url === null) {
console.error(`The version "${version}"" does not found in the "https://deployer.org/manifest.json" file."`)
} else {
console.log(`Downloading "${url}".`)
execa.commandSync(`curl -LO ${url}`)
}
console.log(`Downloading "https://deployer.org/releases/${version}/deployer.phar".`)
execa.commandSync(`curl -LO https://deployer.org/releases/${version}/deployer.phar`)
}
execa.commandSync('sudo chmod +x deployer.phar')
dep = 'deployer.phar'