mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-18 04:28:28 +02:00
chore: base
This commit is contained in:
parent
b04d87b14c
commit
e187173d21
425 changed files with 1080881 additions and 5 deletions
30
src/index.ts
Normal file
30
src/index.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
import { getInput, info, setFailed, setOutput } from '@actions/core';
|
||||
import getGithubRelease from './utils/getGithubRelease.js';
|
||||
import install from './utils/install.js';
|
||||
|
||||
const exit = (error: string) => {
|
||||
setFailed(error);
|
||||
process.exit();
|
||||
}
|
||||
|
||||
const main = async() => {
|
||||
try {
|
||||
const version = getInput('bun-version');
|
||||
const token = getInput('github-token');
|
||||
|
||||
if (!version) return exit('Invalid bun version.');
|
||||
|
||||
const release = await getGithubRelease(version, token);
|
||||
if (release?.message === 'Not Found') return exit('Invalid bun version.');
|
||||
|
||||
info(`Going to install release ${release.tag_name}`);
|
||||
|
||||
await install(release);
|
||||
|
||||
setOutput('deno-version', release.tag_name);
|
||||
} catch(e) {
|
||||
exit(e);
|
||||
}
|
||||
}
|
||||
|
||||
main();
|
Loading…
Add table
Add a link
Reference in a new issue