mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-18 01:55:29 +08:00
climate
This commit is contained in:
parent
153e0fe512
commit
c6275e7b7c
@ -1,41 +1,30 @@
|
|||||||
export default function getURL(
|
export default function getURL(
|
||||||
os: string,
|
system: {
|
||||||
arch: string,
|
os: string,
|
||||||
extended: string,
|
arch: string,
|
||||||
withdeploy: string,
|
},
|
||||||
version: string
|
options: {
|
||||||
|
extended: string,
|
||||||
|
withdeploy: string,
|
||||||
|
version: string
|
||||||
|
}
|
||||||
): string {
|
): string {
|
||||||
const extendedStr = (extended: string): string => {
|
let extendedStr = '';
|
||||||
if (extended === 'true') {
|
if (options.extended === 'true') {
|
||||||
return 'extended_';
|
extendedStr = 'extended_';
|
||||||
} else {
|
}
|
||||||
return '';
|
let withdeployStr = '';
|
||||||
// } else {
|
if (options..withdeploy === 'true') {
|
||||||
// throw new Error(`Invalid input (extended): ${extended}`);
|
withdeployStr = 'withdeploy_';
|
||||||
}
|
}
|
||||||
};
|
let ext = 'tar.gz';
|
||||||
|
if (system.os === 'Windows') {
|
||||||
|
ext = 'zip';
|
||||||
|
}
|
||||||
|
|
||||||
const withdeployStr = (withdeploy: string): string => {
|
const hugoName = `hugo_${extendedStr}${withdeployStr}${options.version}_${system.os}-${system.arch}`;
|
||||||
if (withdeploy === 'true') {
|
|
||||||
return 'withdeploy_';
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
// } else {
|
|
||||||
// throw new Error(`Invalid input (withdeploy): ${withdeploy}`);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const ext = (os: string): string => {
|
|
||||||
if (os === 'Windows') {
|
|
||||||
return 'zip';
|
|
||||||
} else {
|
|
||||||
return 'tar.gz';
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const hugoName = `hugo_${extendedStr(extended)}${withdeployStr(withdeploy)}${version}_${os}-${arch}`;
|
|
||||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
||||||
const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
const url = `${baseURL}/v${options.version}/${hugoName}.${ext}`;
|
||||||
|
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,10 @@ export async function installer(version: string): Promise<void> {
|
|||||||
const archName: string = getArch(process.arch);
|
const archName: string = getArch(process.arch);
|
||||||
core.debug(`Processor Architecture: ${archName}`);
|
core.debug(`Processor Architecture: ${archName}`);
|
||||||
|
|
||||||
const toolURL: string = getURL(osName, archName, extended, withdeploy, version);
|
const system = { os: osName, arch: archName };
|
||||||
|
const options = { extended: extended, withdeploy: withdeploy, version: version }
|
||||||
|
|
||||||
|
const toolURL: string = getURL(system, options);
|
||||||
core.debug(`toolURL: ${toolURL}`);
|
core.debug(`toolURL: ${toolURL}`);
|
||||||
|
|
||||||
const workDir = await createWorkDir();
|
const workDir = await createWorkDir();
|
||||||
|
Loading…
Reference in New Issue
Block a user