mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-05-05 06:45:28 +08:00

* docs: Update description * deps: Add nock * chore: Add resolveJsonModule * test: Add integration testing * chore: Add @typescript-eslint/eslint-plugin * refactor: Fix lint errors * chore: Add eslint-plugin-jest * refactor: Fix lint errors * test: Add remove working files * ci: Comment out cache steps
30 lines
698 B
TypeScript
30 lines
698 B
TypeScript
export default function getURL(
|
|
os: string,
|
|
extended: string,
|
|
version: string
|
|
): string {
|
|
const extendedStr = (extended: string): string => {
|
|
if (extended === 'true') {
|
|
return 'extended_';
|
|
} else {
|
|
return '';
|
|
// } else {
|
|
// throw new Error(`Invalid input (extended): ${extended}`);
|
|
}
|
|
};
|
|
|
|
const ext = (os: string): string => {
|
|
if (os === 'Windows') {
|
|
return 'zip';
|
|
} else {
|
|
return 'tar.gz';
|
|
}
|
|
};
|
|
|
|
const hugoName = `hugo_${extendedStr(extended)}${version}_${os}-64bit`;
|
|
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
|
const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
|
|
|
return url;
|
|
}
|