diff --git a/.gitignore b/.gitignore index 20294dd..83aad51 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ coverage .eslintcache .env node_modules +/.idea diff --git a/src/get-url.ts b/src/get-url.ts index 63f580c..9e81039 100644 --- a/src/get-url.ts +++ b/src/get-url.ts @@ -1,11 +1,13 @@ export default function getURL( os: string, arch: string, - extended: string, + extended: boolean, + withdeploy: boolean, version: string ): string { - const extendedStr = (extended: string): string => { - if (extended === 'true') { + + const extendedStr = (extended: boolean): string => { + if (extended) { return 'extended_'; } else { return ''; @@ -14,6 +16,16 @@ export default function getURL( } }; + const deployStr = (deploy: boolean): string => { + if (deploy) { + return 'withdeploy_'; + } else { + return ''; + // } else { + // throw new Error(`Invalid input (extended): ${extended}`); + } + }; + const ext = (os: string): string => { if (os === 'Windows') { return 'zip'; @@ -22,7 +34,7 @@ export default function getURL( } }; - const hugoName = `hugo_${extendedStr(extended)}${version}_${os}-${arch}`; + const hugoName = `hugo_${extendedStr(extended)}${deployStr(withdeploy)}${version}_${os}-${arch}`; const baseURL = 'https://github.com/gohugoio/hugo/releases/download'; const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`; diff --git a/src/installer.ts b/src/installer.ts index e3dfd35..97cf3f9 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -44,16 +44,19 @@ export async function createBinDir(workDir: string): Promise { } export async function installer(version: string): Promise { - const extended: string = core.getInput('extended'); + const extended: boolean = core.getInput('extended'); core.debug(`Hugo extended: ${extended}`); + const withDeploy: boolean = core.getInput('withDeploy'); + core.debug(`Hugo withDeploy: ${withDeploy}`); + const osName: string = getOS(process.platform); core.debug(`Operating System: ${osName}`); const archName: string = getArch(process.arch); core.debug(`Processor Architecture: ${archName}`); - const toolURL: string = getURL(osName, archName, extended, version); + const toolURL: string = getURL(osName, archName, extended, withDeploy, version); core.debug(`toolURL: ${toolURL}`); const workDir = await createWorkDir();