mirror of
https://github.com/deployphp/action.git
synced 2024-11-26 21:59:02 +00:00
Download based on manifest.json
This commit is contained in:
parent
732002f64c
commit
0d8e60c62d
19
index.js
19
index.js
@ -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'
|
||||
|
Loading…
Reference in New Issue
Block a user