mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2025-06-07 01:25:27 +08:00
Added withDeploy flag allowing users to install builds with deploy support in CI/CD pipelines
This commit is contained in:
parent
3a287949d3
commit
0cadccf22b
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ coverage
|
||||
.eslintcache
|
||||
.env
|
||||
node_modules
|
||||
/.idea
|
||||
|
@ -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)}`;
|
||||
|
||||
|
@ -44,16 +44,19 @@ export async function createBinDir(workDir: string): Promise<string> {
|
||||
}
|
||||
|
||||
export async function installer(version: string): Promise<void> {
|
||||
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();
|
||||
|
Loading…
Reference in New Issue
Block a user