fix: support GitPeji tags and interactive helper auth
APT build checks / build-checks (push) Has been cancelled

This commit is contained in:
2026-08-19 22:39:40 +00:00
parent 808698dc46
commit 8dad96c27d
5 changed files with 64 additions and 8 deletions
+10 -4
View File
@@ -8,7 +8,7 @@ const REQUEST_TIMEOUT_MS = 5000;
const MAX_BODY_BYTES = 64 * 1024;
const MAX_RELEASE_NAME_LENGTH = 200;
// SemVer 2.0.0 without loose forms such as a leading "v" or omitted fields.
// Strict SemVer 2.0.0 without loose forms such as omitted fields.
const SEMVER_PATTERN = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*)(?:\.(?:0|[1-9]\d*|\d*[A-Za-z-][0-9A-Za-z-]*))*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/;
class UpdatePolicyError extends Error {
@@ -41,6 +41,12 @@ function parseSemver(version, errorCode = 'INVALID_VERSION') {
};
}
function normalizeReleaseTag(tag) {
const version = tag.startsWith('v') ? tag.slice(1) : tag;
parseSemver(version, 'INVALID_RELEASE_VERSION');
return version;
}
function compareIdentifier(left, right) {
const leftNumeric = /^\d+$/.test(left);
const rightNumeric = /^\d+$/.test(right);
@@ -290,14 +296,14 @@ async function checkForUpdate({
}
const release = parseRelease(body);
parseSemver(release.latestVersion, 'INVALID_RELEASE_VERSION');
const latestVersion = normalizeReleaseTag(release.latestVersion);
const metadata = {
status: compareSemver(release.latestVersion, currentVersion) > 0
status: compareSemver(latestVersion, currentVersion) > 0
? 'update-available'
: 'up-to-date',
...baseMetadata,
latestVersion: release.latestVersion,
latestVersion,
releaseName: release.releaseName,
};
if (release.publishedAt !== undefined) {