Added withDeploy flag allowing users to install builds with deploy support in CI/CD pipelines

This commit is contained in:
Vlad Kyrylenko 2025-01-03 17:36:35 -05:00
parent 3a287949d3
commit 0cadccf22b
3 changed files with 22 additions and 6 deletions

View file

@ -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)}`;