mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-07-22 12:43:15 +08:00
* feat: support for multiple registries * [autofix.ci] apply automated fixes * refactor: drop unnecessary check * fix: pass empty array instead undefined * [autofix.ci] apply automated fixes * fix: dont add registry set line * [autofix.ci] apply automated fixes * feat: few more tests * feat: add bun types * docs: explain registries * feat: save globally * [autofix.ci] apply automated fixes * ci: jsr registry test * ci: add , * ci: test * ci: test * ci: test * ci: test * [autofix.ci] apply automated fixes * feat: use @iarna/toml * [autofix.ci] apply automated fixes * feat: registry parsing * [autofix.ci] apply automated fixes * ci: verbose add * ci: registry install check * ci: registry install check * ci: registry install check * ci: verify registry usage * docs: registries * docs: important block * docs: show table * docs: show table * ci: shell * ci: registry test on linux * ci: registry test on linux * build: text lockfile --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
46 lines
1.2 KiB
TypeScript
46 lines
1.2 KiB
TypeScript
import { tmpdir } from "node:os";
|
|
import { getInput, setOutput, setFailed, getBooleanInput } from "@actions/core";
|
|
import runAction from "./action.js";
|
|
import { readVersionFromFile } from "./utils.js";
|
|
import { parseRegistries } from "./registry.js";
|
|
|
|
if (!process.env.RUNNER_TEMP) {
|
|
process.env.RUNNER_TEMP = tmpdir();
|
|
}
|
|
|
|
const registries = parseRegistries(getInput("registries"));
|
|
|
|
// Backwards compatibility for the `registry-url` and `scope` inputs
|
|
const registryUrl = getInput("registry-url");
|
|
const scope = getInput("scope");
|
|
|
|
if (registryUrl) {
|
|
registries.push({
|
|
url: registryUrl,
|
|
scope: scope,
|
|
token: "$BUN_AUTH_TOKEN",
|
|
});
|
|
}
|
|
|
|
runAction({
|
|
version:
|
|
getInput("bun-version") ||
|
|
readVersionFromFile(getInput("bun-version-file")) ||
|
|
undefined,
|
|
customUrl: getInput("bun-download-url") || undefined,
|
|
registries: registries,
|
|
noCache: getBooleanInput("no-cache") || false,
|
|
})
|
|
.then(({ version, revision, bunPath, url, cacheHit }) => {
|
|
setOutput("bun-version", version);
|
|
setOutput("bun-revision", revision);
|
|
setOutput("bun-path", bunPath);
|
|
setOutput("bun-download-url", url);
|
|
setOutput("cache-hit", cacheHit);
|
|
process.exit(0);
|
|
})
|
|
.catch((error) => {
|
|
setFailed(error);
|
|
process.exit(1);
|
|
});
|