local-setup-docker-cli-action/src/install.ts

22 lines
683 B
TypeScript

import * as core from '@actions/core'
import * as tc from '@actions/tool-cache'
import path from 'path'
const DownloadBaseUrl = 'https://joylink.club/public-files/docker/'
export function getFilename(version: string): string {
return `docker-${version}.tgz`
}
/**
* 下载docker二进制包并解压,返回docker目录
*/
export async function download(filename: string): Promise<string> {
const url = `${DownloadBaseUrl}${filename}`
core.info(`Downloading Docker from ${url}`)
const downloadPath = await tc.downloadTool(url)
core.info(`Extracting Docker to ${downloadPath}`)
const extpath = await tc.extractTar(downloadPath)
return path.join(extpath, 'docker')
}