mirror of
https://github.com/jdx/mise-action.git
synced 2026-05-20 00:11:54 +00:00
feat: fetch tarball with zst compression (#153)
This commit is contained in:
parent
5bb8f8c191
commit
370e73c4f0
6 changed files with 132 additions and 125 deletions
39
src/index.ts
39
src/index.ts
|
|
@ -130,29 +130,30 @@ async function setupMise(version: string): Promise<void> {
|
|||
if (!fs.existsSync(path.join(miseBinPath))) {
|
||||
core.startGroup(version ? `Download mise@${version}` : 'Setup mise')
|
||||
await fs.promises.mkdir(miseBinDir, { recursive: true })
|
||||
const ext =
|
||||
getOS() === 'windows'
|
||||
? '.zip'
|
||||
: version && version.startsWith('2024')
|
||||
? ''
|
||||
: '.tar.zst'
|
||||
const url = version
|
||||
? `https://mise.jdx.dev/v${version}/mise-v${version}-${getOS()}-${os.arch()}`
|
||||
: `https://mise.jdx.dev/mise-latest-${getOS()}-${os.arch()}`
|
||||
? `https://mise.jdx.dev/v${version}/mise-v${version}-${getOS()}-${os.arch()}${ext}`
|
||||
: `https://mise.jdx.dev/mise-latest-${getOS()}-${os.arch()}${ext}`
|
||||
const archivePath = path.join(os.tmpdir(), `mise${ext}`)
|
||||
if (getOS() === 'windows') {
|
||||
const zipPath = path.join(os.tmpdir(), 'mise.zip')
|
||||
await exec.exec('curl', [
|
||||
'--compressed',
|
||||
'-fsSL',
|
||||
`${url}.zip`,
|
||||
'--output',
|
||||
zipPath
|
||||
])
|
||||
await exec.exec('unzip', [zipPath, '-d', os.tmpdir()])
|
||||
await exec.exec('curl', ['-fsSL', url, '--output', archivePath])
|
||||
await exec.exec('unzip', [archivePath, '-d', os.tmpdir()])
|
||||
await io.mv(path.join(os.tmpdir(), 'mise/bin/mise.exe'), miseBinPath)
|
||||
} else {
|
||||
await exec.exec('curl', [
|
||||
'--compressed',
|
||||
'-fsSL',
|
||||
url,
|
||||
'--output',
|
||||
miseBinPath
|
||||
])
|
||||
await exec.exec('chmod', ['+x', miseBinPath])
|
||||
if (ext === '') {
|
||||
await exec.exec('sh', ['-c', `curl -fsSL ${url} > ${miseBinPath}`])
|
||||
await exec.exec('chmod', ['+x', miseBinPath])
|
||||
} else {
|
||||
await exec.exec('sh', [
|
||||
'-c',
|
||||
`curl -fsSL ${url} | tar --zstd -xf - -C ${os.tmpdir()} && mv ${os.tmpdir()}/mise/bin/mise ${miseBinPath}`
|
||||
])
|
||||
}
|
||||
}
|
||||
}
|
||||
core.addPath(miseBinDir)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue