mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-02-23 10:40:10 +08:00
feat: add support for test builds
This commit is contained in:
parent
81ecfb54f4
commit
9f7c2a5c23
7
.github/workflows/test.yml
vendored
7
.github/workflows/test.yml
vendored
@ -14,16 +14,19 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, macos-latest]
|
os: [ubuntu-latest, macos-latest]
|
||||||
bun-version:
|
bun-version:
|
||||||
["latest", "0.1.3"]
|
["latest", "0.1.3", "latest"]
|
||||||
|
misc-test-builds:
|
||||||
|
[false, false, true]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Bun
|
- name: Setup Bun - Test Builds * ${{ matrix.misc-test-builds }}
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
bun-version: ${{ matrix.bun-version }}
|
bun-version: ${{ matrix.bun-version }}
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
misc-test-builds: ${{ matrix.misc-test-builds }}
|
||||||
|
|
||||||
- name: Try bun
|
- name: Try bun
|
||||||
run: bun --version
|
run: bun --version
|
@ -12,6 +12,9 @@ inputs:
|
|||||||
default: "latest"
|
default: "latest"
|
||||||
github-token:
|
github-token:
|
||||||
description: "The github token secret can be passed in using {{ secrets.GITHUB_TOKEN }}"
|
description: "The github token secret can be passed in using {{ secrets.GITHUB_TOKEN }}"
|
||||||
|
misc-test-builds:
|
||||||
|
description: "Install builds from https://github.com/oven-sh/misc-test-builds (not recommended!)"
|
||||||
|
required: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
bun-version:
|
bun-version:
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { getInput } from '@actions/core';
|
||||||
import fetch from 'node-fetch';
|
import fetch from 'node-fetch';
|
||||||
|
|
||||||
export interface Asset {
|
export interface Asset {
|
||||||
@ -6,6 +7,7 @@ export interface Asset {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface Release {
|
export interface Release {
|
||||||
|
name: string;
|
||||||
html_url: string;
|
html_url: string;
|
||||||
tag_name: string;
|
tag_name: string;
|
||||||
message?: string;
|
message?: string;
|
||||||
@ -14,9 +16,11 @@ export interface Release {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export default async(version: string, token: string): Promise<Release> => {
|
export default async(version: string, token: string): Promise<Release> => {
|
||||||
|
const miscTestBuilds = getInput('misc-test-builds');
|
||||||
|
const repository = miscTestBuilds ? miscTestBuilds : 'oven-sh/bun'
|
||||||
let url;
|
let url;
|
||||||
if (version === 'latest') url = 'https://api.github.com/repos/oven-sh/bun/releases/latest';
|
if (version === '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}`;
|
else url = `https://api.github.com/repos/${repository}/releases/tags/bun-v${version}`;
|
||||||
|
|
||||||
const release: any = await (await fetch(url, {
|
const release: any = await (await fetch(url, {
|
||||||
headers: {
|
headers: {
|
||||||
@ -28,6 +32,6 @@ export default async(version: string, token: string): Promise<Release> => {
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
...release,
|
...release,
|
||||||
version: release.tag_name.replace('bun-v', '')
|
version: miscTestBuilds ? new Date(release.name).getTime() : release.tag_name.replace('bun-v', '')
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user