mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 04:28:28 +02:00
Next release of setup-bun
This commit is contained in:
parent
ed9eb0969c
commit
9c14b74b45
1082 changed files with 242557 additions and 173810 deletions
37
src/index.ts
37
src/index.ts
|
@ -1,37 +0,0 @@
|
|||
import { getInput, info, setFailed, setOutput, warning } from '@actions/core';
|
||||
import getGithubRelease from './utils/getGithubRelease.js';
|
||||
import install from './utils/install.js';
|
||||
|
||||
export const exit = (error: string, miscTestBuilds?: boolean) => {
|
||||
if (miscTestBuilds) {
|
||||
warning(error);
|
||||
} else {
|
||||
setFailed(error);
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
|
||||
const main = async() => {
|
||||
try {
|
||||
const version = getInput('bun-version');
|
||||
const token = getInput('github-token');
|
||||
const repository = getInput('repository');
|
||||
const miscTestBuilds = (getInput('misc-test-builds') === 'true') || (repository.includes('oven-sh/misc-test-builds'));
|
||||
const customDownloadUrl = getInput('custom-download-url') || null;
|
||||
|
||||
if (!version) return exit('Invalid bun version.');
|
||||
|
||||
const release = await getGithubRelease(version, token, repository, customDownloadUrl, miscTestBuilds);
|
||||
if (release?.message === 'Not Found') return exit('Invalid bun version.', miscTestBuilds);
|
||||
|
||||
info(`Going to install release ${release.version}`);
|
||||
|
||||
await install(release, token, customDownloadUrl !== null);
|
||||
|
||||
setOutput('bun-version', release.tag_name);
|
||||
} catch(e) {
|
||||
exit(e);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
Loading…
Add table
Add a link
Reference in a new issue