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