0.4.0 • Published 2 years ago
@zcong/actions-installer v0.4.0
actions-installer
Easily build a setup actions
Install
$ yarn add @zcong/actions-installer
Usage
import { Installer } from '@zcong/actions-installer'
import * as core from '@actions/core'
class DockerizeInstaller extends Installer {
constructor() {
super('dockerize')
}
setupDir() {
if (process.platform === 'win32') {
core.setFailed('not support windows platform')
}
super.setupDir()
}
getDownloadUrlByVersion(version: string): string {
const platform: string = this.osPlat
const arch: string = this.osArch == 'x64' ? 'amd64' : '386'
const filename: string = `dockerize-${platform}-${arch}-v${version}.tar.gz`
return `https://github.com/jwilder/dockerize/releases/download/v${version}/${filename}`
}
}
const instance = new DockerizeInstaller()
async function run() {
try {
const version = core.getInput('dockerize-version')
if (version) {
await instance.getTools(version)
}
} catch (error) {
core.setFailed(error.message)
}
}
run()
License
MIT © zcong1993