chore: build

This commit is contained in:
xHyroM 2022-07-12 18:42:27 +02:00
parent 9f7c2a5c23
commit 054bb2f631
2 changed files with 7 additions and 4 deletions

View File

@ -1,10 +1,13 @@
import { getInput } from '@actions/core';
import fetch from 'node-fetch';
export default async (version, token) => {
const miscTestBuilds = (getInput('misc-test-builds') === 'true');
const repository = miscTestBuilds ? miscTestBuilds : 'oven-sh/bun';
let url;
if (version === 'latest')
url = 'https://api.github.com/repos/oven-sh/bun/releases/latest';
url = `https://api.github.com/repos/${repository}/releases/latest`;
else
url = `https://api.github.com/repos/oven-sh/bun/releases/tags/bun-v${version}`;
url = `https://api.github.com/repos/${repository}/releases/tags/bun-v${version}`;
const release = await (await fetch(url, {
headers: {
'Content-Type': 'application/json',
@ -14,6 +17,6 @@ export default async (version, token) => {
})).json();
return {
...release,
version: release.tag_name.replace('bun-v', '')
version: miscTestBuilds ? new Date(release.name).getTime() : release.tag_name.replace('bun-v', '')
};
};

View File

@ -16,7 +16,7 @@ export interface Release {
}
export default async(version: string, token: string): Promise<Release> => {
const miscTestBuilds = getInput('misc-test-builds');
const miscTestBuilds = (getInput('misc-test-builds') === 'true');
const repository = miscTestBuilds ? miscTestBuilds : 'oven-sh/bun'
let url;
if (version === 'latest') url = `https://api.github.com/repos/${repository}/releases/latest`;