fix: extract build-id into seperate package to fix publishing (#3194)

Also makes it easier to replace during bundling.
This commit is contained in:
Marvin Hagemeister
2025-08-06 12:53:50 +02:00
committed by GitHub
parent ba2e01fec0
commit 83036d87ee
18 changed files with 41 additions and 16 deletions
+19
View File
@@ -0,0 +1,19 @@
import { encodeHex } from "@std/encoding/hex";
export const DENO_DEPLOYMENT_ID: string | undefined = Deno.env.get(
"DENO_DEPLOYMENT_ID",
);
const deploymentId = DENO_DEPLOYMENT_ID ||
// For CI
Deno.env.get("GITHUB_SHA") ||
crypto.randomUUID();
const buildIdHash = await crypto.subtle.digest(
"SHA-1",
new TextEncoder().encode(deploymentId),
);
export let BUILD_ID: string = encodeHex(buildIdHash);
export function setBuildId(buildId: string): void {
BUILD_ID = buildId;
}