mirror of
https://github.com/oven-sh/setup-bun.git
synced 2025-02-23 18:50:10 +08:00
Fix not being added to path
This commit is contained in:
parent
9c14b74b45
commit
3f252a86a6
4
dist/action.js
vendored
4
dist/action.js
vendored
@ -11,7 +11,7 @@ setup({
|
|||||||
.then(({ version, cacheHit }) => {
|
.then(({ version, cacheHit }) => {
|
||||||
action.setOutput("bun-version", version);
|
action.setOutput("bun-version", version);
|
||||||
action.setOutput("cache-hit", cacheHit ? "1" : "0");
|
action.setOutput("cache-hit", cacheHit ? "1" : "0");
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
action.setFailed(error);
|
action.setFailed(error);
|
||||||
});
|
});
|
||||||
|
23
dist/setup.js
vendored
23
dist/setup.js
vendored
@ -10,7 +10,9 @@ import { getExecOutput } from "@actions/exec";
|
|||||||
export default async (options) => {
|
export default async (options) => {
|
||||||
const { url, cacheKey } = getDownloadUrl(options);
|
const { url, cacheKey } = getDownloadUrl(options);
|
||||||
const cacheEnabled = cacheKey && cache.isFeatureAvailable();
|
const cacheEnabled = cacheKey && cache.isFeatureAvailable();
|
||||||
const path = join(homedir(), ".bun", "bin", "bun");
|
const dir = join(homedir(), ".bun", "bin");
|
||||||
|
action.addPath(dir);
|
||||||
|
const path = join(dir, "bun");
|
||||||
let version;
|
let version;
|
||||||
let cacheHit = false;
|
let cacheHit = false;
|
||||||
if (cacheEnabled) {
|
if (cacheEnabled) {
|
||||||
@ -20,10 +22,9 @@ export default async (options) => {
|
|||||||
if (version) {
|
if (version) {
|
||||||
cacheHit = true;
|
cacheHit = true;
|
||||||
action.info("Using a cached version of Bun.");
|
action.info("Using a cached version of Bun.");
|
||||||
} else {
|
}
|
||||||
action.warning(
|
else {
|
||||||
"Found a cached version of Bun, but it appears to be corrupted? Attempting to download a new version."
|
action.warning("Found a cached version of Bun, but it appears to be corrupted? Attempting to download a new version.");
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,14 +37,13 @@ export default async (options) => {
|
|||||||
version = await verifyBun(path);
|
version = await verifyBun(path);
|
||||||
}
|
}
|
||||||
if (!version) {
|
if (!version) {
|
||||||
throw new Error(
|
throw new Error("Downloaded a new version of Bun, but failed to check its version? Try again in debug mode.");
|
||||||
"Downloaded a new version of Bun, but failed to check its version? Try again in debug mode."
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (cacheEnabled) {
|
if (cacheEnabled) {
|
||||||
try {
|
try {
|
||||||
await saveCache([path], cacheKey);
|
await saveCache([path], cacheKey);
|
||||||
} catch (error) {
|
}
|
||||||
|
catch (error) {
|
||||||
action.warning("Failed to save Bun to cache.");
|
action.warning("Failed to save Bun to cache.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -64,10 +64,7 @@ function getDownloadUrl(options) {
|
|||||||
const arch = options?.arch ?? process.arch;
|
const arch = options?.arch ?? process.arch;
|
||||||
const avx2 = options?.avx2 ?? true;
|
const avx2 = options?.avx2 ?? true;
|
||||||
const profile = options?.profile ?? false;
|
const profile = options?.profile ?? false;
|
||||||
const { href } = new URL(
|
const { href } = new URL(`${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`, "https://bun.sh/download/");
|
||||||
`${release}/${os}/${arch}?avx2=${avx2}&profile=${profile}`,
|
|
||||||
"https://bun.sh/download/"
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
url: href,
|
url: href,
|
||||||
cacheKey: /^canary|latest$/i.test(release)
|
cacheKey: /^canary|latest$/i.test(release)
|
||||||
|
@ -17,7 +17,9 @@ export default async (options?: {
|
|||||||
}> => {
|
}> => {
|
||||||
const { url, cacheKey } = getDownloadUrl(options);
|
const { url, cacheKey } = getDownloadUrl(options);
|
||||||
const cacheEnabled = cacheKey && cache.isFeatureAvailable();
|
const cacheEnabled = cacheKey && cache.isFeatureAvailable();
|
||||||
const path = join(homedir(), ".bun", "bin", "bun");
|
const dir = join(homedir(), ".bun", "bin");
|
||||||
|
action.addPath(dir);
|
||||||
|
const path = join(dir, "bun");
|
||||||
let version: string | undefined;
|
let version: string | undefined;
|
||||||
let cacheHit = false;
|
let cacheHit = false;
|
||||||
if (cacheEnabled) {
|
if (cacheEnabled) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user