Skip to content

Commit

Permalink
Download based on manifest.json
Browse files Browse the repository at this point in the history
  • Loading branch information
antonmedv authored Oct 24, 2021
1 parent 732002f commit 0d8e60c
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 0d8e60c

Please sign in to comment.