From 37397a08ec8cffd2be9d318da9308fe30ebb24de Mon Sep 17 00:00:00 2001 From: xHyroM Date: Mon, 25 Jul 2022 22:31:43 +0200 Subject: [PATCH] feat: canary support --- README.md | 5 ++--- dist/utils/getGithubRelease.js | 2 +- package.json | 2 +- src/utils/getGithubRelease.ts | 3 +-- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1eb66a2..e4e966a 100644 --- a/README.md +++ b/README.md @@ -21,11 +21,10 @@ Set up your GitHub Actions workflow with a specific version of Bun. bun-version: "0.1.3" ``` -### Test builds +### Canary builds ```yaml - uses: xhyrom/setup-bun@v0.1.3 with: - bun-version: latest - misc-test-builds: true + bun-version: canary ``` diff --git a/dist/utils/getGithubRelease.js b/dist/utils/getGithubRelease.js index c819004..25d54b3 100644 --- a/dist/utils/getGithubRelease.js +++ b/dist/utils/getGithubRelease.js @@ -5,7 +5,7 @@ export default async (version, token, miscTestBuilds) => { if (version === 'latest' || miscTestBuilds) url = `https://api.github.com/repos/${repository}/releases/latest`; else - url = `https://api.github.com/repos/${repository}/releases/tags/bun-v${version}`; + url = `https://api.github.com/repos/${repository}/releases/tags/${version.includes('canary') ? version : `bun-v${version}`}`; const release = await (await fetch(url, { headers: { 'Content-Type': 'application/json', diff --git a/package.json b/package.json index 9bfbd6b..e1a67eb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "version": "0.1.4", + "version": "0.1.5", "name": "setup-bun", "main": "dist/index.js", "type": "module", diff --git a/src/utils/getGithubRelease.ts b/src/utils/getGithubRelease.ts index 540a8e4..0db0658 100644 --- a/src/utils/getGithubRelease.ts +++ b/src/utils/getGithubRelease.ts @@ -1,4 +1,3 @@ -import { getInput } from '@actions/core'; import fetch from 'node-fetch'; export interface Asset { @@ -19,7 +18,7 @@ export default async(version: string, token: string, miscTestBuilds: boolean): P const repository = miscTestBuilds ? 'oven-sh/misc-test-builds' : 'oven-sh/bun' let url; if (version === 'latest' || miscTestBuilds) url = `https://api.github.com/repos/${repository}/releases/latest`; - else url = `https://api.github.com/repos/${repository}/releases/tags/bun-v${version}`; + else url = `https://api.github.com/repos/${repository}/releases/tags/${version.includes('canary') ? version : `bun-v${version}`}`; const release: any = await (await fetch(url, { headers: {