learnhouse 1.3.1 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/learnhouse.js +19 -6
- package/package.json +1 -1
package/dist/bin/learnhouse.js
CHANGED
|
@@ -3616,7 +3616,7 @@ var {
|
|
|
3616
3616
|
var import_picocolors19 = __toESM(require_picocolors(), 1);
|
|
3617
3617
|
|
|
3618
3618
|
// src/constants.ts
|
|
3619
|
-
var VERSION = "1.3.
|
|
3619
|
+
var VERSION = "1.3.2";
|
|
3620
3620
|
var APP_IMAGE = "ghcr.io/learnhouse/app:latest";
|
|
3621
3621
|
var DEV_IMAGE = "ghcr.io/learnhouse/app:dev";
|
|
3622
3622
|
var POSTGRES_IMAGE = "postgres:16-alpine";
|
|
@@ -3723,16 +3723,29 @@ async function resolveAppImage(channel = "stable") {
|
|
|
3723
3723
|
if (channel === "dev") {
|
|
3724
3724
|
return { image: DEV_IMAGE, isLatest: false };
|
|
3725
3725
|
}
|
|
3726
|
-
const versionedTag = `${GHCR_BASE}:${VERSION}`;
|
|
3727
3726
|
try {
|
|
3727
|
+
const releasesResp = await fetch(
|
|
3728
|
+
"https://api.github.com/repos/learnhouse/learnhouse/releases",
|
|
3729
|
+
{
|
|
3730
|
+
signal: AbortSignal.timeout(5e3),
|
|
3731
|
+
headers: { Accept: "application/vnd.github+json" }
|
|
3732
|
+
}
|
|
3733
|
+
);
|
|
3734
|
+
if (!releasesResp.ok) throw new Error("GitHub API failed");
|
|
3735
|
+
const releases = await releasesResp.json();
|
|
3736
|
+
const appRelease = releases.find(
|
|
3737
|
+
(r) => !r.draft && !r.prerelease && !r.tag_name.startsWith("cli-")
|
|
3738
|
+
);
|
|
3739
|
+
if (!appRelease) throw new Error("No app release found");
|
|
3740
|
+
const appVersion = appRelease.tag_name;
|
|
3728
3741
|
const tokenResp = await fetch(
|
|
3729
|
-
|
|
3742
|
+
"https://ghcr.io/token?scope=repository:learnhouse/app:pull",
|
|
3730
3743
|
{ signal: AbortSignal.timeout(5e3) }
|
|
3731
3744
|
);
|
|
3732
|
-
if (!tokenResp.ok) throw new Error("token
|
|
3745
|
+
if (!tokenResp.ok) throw new Error("GHCR token failed");
|
|
3733
3746
|
const { token } = await tokenResp.json();
|
|
3734
3747
|
const manifestResp = await fetch(
|
|
3735
|
-
`https://ghcr.io/v2/learnhouse/app/manifests/${
|
|
3748
|
+
`https://ghcr.io/v2/learnhouse/app/manifests/${appVersion}`,
|
|
3736
3749
|
{
|
|
3737
3750
|
signal: AbortSignal.timeout(5e3),
|
|
3738
3751
|
headers: {
|
|
@@ -3742,7 +3755,7 @@ async function resolveAppImage(channel = "stable") {
|
|
|
3742
3755
|
}
|
|
3743
3756
|
);
|
|
3744
3757
|
if (manifestResp.ok) {
|
|
3745
|
-
return { image:
|
|
3758
|
+
return { image: `${GHCR_BASE}:${appVersion}`, isLatest: false };
|
|
3746
3759
|
}
|
|
3747
3760
|
} catch {
|
|
3748
3761
|
}
|