feat: cache storefront versions for ota policy
This commit is contained in:
@@ -16,9 +16,6 @@ const DEFAULT_DESKTOP_PROJECT_DIR = join(REPO_ROOT, "apps", "desktop")
|
||||
const OTA_PLATFORMS = ["ios", "android"]
|
||||
const DESKTOP_PLATFORMS = new Set(["macos", "windows", "linux"])
|
||||
const DESKTOP_DEFAULT_CHANNEL = "stable"
|
||||
const DESKTOP_MAC_APP_STORE_URL =
|
||||
"https://apps.apple.com/us/app/folo-follow-everything/id6739802604"
|
||||
const DESKTOP_MICROSOFT_STORE_URL = "https://apps.microsoft.com/detail/9nvfzpv0v0ht?mode=direct"
|
||||
const CONTENT_TYPES = new Map([
|
||||
[".aac", "audio/aac"],
|
||||
[".bmp", "image/bmp"],
|
||||
@@ -252,17 +249,14 @@ export async function buildDesktopReleaseAssets(options = {}) {
|
||||
const releaseKind = releaseConfig.mode === "ota" ? "ota" : "binary"
|
||||
const runtimeVersion = releaseConfig.mode === "ota" ? releaseConfig.runtimeVersion : null
|
||||
const channel = releaseConfig.channel ?? DESKTOP_DEFAULT_CHANNEL
|
||||
const desktopApp =
|
||||
releaseConfig.mode === "binary-policy"
|
||||
? null
|
||||
: await collectDesktopAppPayload({
|
||||
projectDir,
|
||||
owner,
|
||||
repo,
|
||||
gitTag,
|
||||
})
|
||||
const desktopApp = await collectDesktopAppPayload({
|
||||
projectDir,
|
||||
owner,
|
||||
repo,
|
||||
gitTag,
|
||||
})
|
||||
|
||||
if (releaseConfig.mode !== "binary-policy" && !desktopApp) {
|
||||
if (!desktopApp) {
|
||||
throw new Error(
|
||||
`Desktop ${releaseConfig.mode} mode requires direct installer manifests in ${join(projectDir, "out", "make")}`,
|
||||
)
|
||||
@@ -292,16 +286,10 @@ export async function buildDesktopReleaseAssets(options = {}) {
|
||||
commit: gitCommit,
|
||||
},
|
||||
policy: {
|
||||
required: releaseConfig.required ?? false,
|
||||
required: false,
|
||||
minSupportedBinaryVersion: process.env.OTA_MIN_SUPPORTED_BINARY_VERSION ?? releaseVersion,
|
||||
message: releaseConfig.message ?? null,
|
||||
distributions: resolveDesktopPolicyDistributions({
|
||||
mode: releaseConfig.mode,
|
||||
distributions: releaseConfig.distributions ?? [],
|
||||
owner,
|
||||
repo,
|
||||
gitTag,
|
||||
}),
|
||||
message: null,
|
||||
distributions: {},
|
||||
},
|
||||
desktop: {
|
||||
renderer: desktopRenderer,
|
||||
@@ -853,53 +841,6 @@ function buildGitHubAssetUrl({ owner, repo, tag, filename }) {
|
||||
return `https://github.com/${owner}/${repo}/releases/download/${tag}/${filename}`
|
||||
}
|
||||
|
||||
function buildGitHubReleaseUrl({ owner, repo, tag }) {
|
||||
return `https://github.com/${owner}/${repo}/releases/tag/${tag}`
|
||||
}
|
||||
|
||||
function resolveDesktopPolicyDistributions({ mode, distributions, owner, repo, gitTag }) {
|
||||
const normalizedDistributions =
|
||||
mode === "build" && distributions.length === 0 ? ["direct"] : distributions
|
||||
|
||||
return Object.fromEntries(
|
||||
normalizedDistributions.map((distribution) => {
|
||||
switch (distribution) {
|
||||
case "direct": {
|
||||
return [
|
||||
distribution,
|
||||
{
|
||||
downloadUrl: buildGitHubReleaseUrl({
|
||||
owner,
|
||||
repo,
|
||||
tag: gitTag,
|
||||
}),
|
||||
},
|
||||
]
|
||||
}
|
||||
case "mas": {
|
||||
return [
|
||||
distribution,
|
||||
{
|
||||
storeUrl: DESKTOP_MAC_APP_STORE_URL,
|
||||
},
|
||||
]
|
||||
}
|
||||
case "mss": {
|
||||
return [
|
||||
distribution,
|
||||
{
|
||||
storeUrl: DESKTOP_MICROSOFT_STORE_URL,
|
||||
},
|
||||
]
|
||||
}
|
||||
default: {
|
||||
throw new Error(`Unsupported desktop distribution "${distribution}"`)
|
||||
}
|
||||
}
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
function resolveRepository(options) {
|
||||
if (options.owner && options.repo) {
|
||||
return [options.owner, options.repo]
|
||||
|
||||
@@ -314,9 +314,6 @@ describe("buildDesktopReleaseAssets", () => {
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
manifests: [
|
||||
{
|
||||
@@ -346,11 +343,7 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
expect(result.otaMetadata.runtimeVersion).toBeNull()
|
||||
expect(result.otaMetadata.channel).toBe("stable")
|
||||
expect(result.otaMetadata.desktop.renderer).toBeNull()
|
||||
expect(result.otaMetadata.policy.distributions).toEqual({
|
||||
direct: {
|
||||
downloadUrl: "https://github.com/RSSNext/Folo/releases/tag/desktop/v1.5.1",
|
||||
},
|
||||
})
|
||||
expect(result.otaMetadata.policy.distributions).toEqual({})
|
||||
expect(result.otaMetadata.desktop.app.platforms.windows).toEqual(
|
||||
expect.objectContaining({
|
||||
platform: "windows-x64",
|
||||
@@ -386,9 +379,6 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
mode: "ota",
|
||||
runtimeVersion: "1.5.0",
|
||||
channel: "stable",
|
||||
distributions: ["direct"],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
rendererArchiveContents: "renderer archive",
|
||||
rendererManifestContents: `
|
||||
@@ -446,95 +436,6 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
expect(result.archivePath).not.toBeNull()
|
||||
})
|
||||
|
||||
it("builds desktop binary-policy metadata without dist.tar.zst", async () => {
|
||||
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
|
||||
const projectDir = await createDesktopProjectFixture({
|
||||
version: "1.5.1",
|
||||
releaseConfig: {
|
||||
version: "1.5.1",
|
||||
mode: "binary-policy",
|
||||
runtimeVersion: null,
|
||||
channel: "stable",
|
||||
distributions: ["mas", "mss"],
|
||||
required: true,
|
||||
message: "Install the latest desktop app.",
|
||||
},
|
||||
})
|
||||
|
||||
const result = await buildDesktopReleaseAssets({
|
||||
projectDir,
|
||||
owner: "RSSNext",
|
||||
repo: "Folo",
|
||||
})
|
||||
|
||||
expect(result.otaMetadata.schemaVersion).toBe(2)
|
||||
expect(result.otaMetadata.releaseKind).toBe("binary")
|
||||
expect(result.otaMetadata.runtimeVersion).toBeNull()
|
||||
expect(result.otaMetadata.channel).toBe("stable")
|
||||
expect(result.otaMetadata.policy).toEqual({
|
||||
required: true,
|
||||
minSupportedBinaryVersion: "1.5.1",
|
||||
message: "Install the latest desktop app.",
|
||||
distributions: {
|
||||
mas: {
|
||||
storeUrl: "https://apps.apple.com/us/app/folo-follow-everything/id6739802604",
|
||||
},
|
||||
mss: {
|
||||
storeUrl: "https://apps.microsoft.com/detail/9nvfzpv0v0ht?mode=direct",
|
||||
},
|
||||
},
|
||||
})
|
||||
expect(result.otaMetadata.desktop).toEqual({
|
||||
renderer: null,
|
||||
app: null,
|
||||
})
|
||||
expect(result.archivePath).toBeNull()
|
||||
})
|
||||
|
||||
it("keeps desktop binary-policy metadata installer-free even if manifests exist", async () => {
|
||||
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
|
||||
const projectDir = await createDesktopProjectFixture({
|
||||
version: "1.5.1",
|
||||
releaseConfig: {
|
||||
version: "1.5.1",
|
||||
mode: "binary-policy",
|
||||
runtimeVersion: null,
|
||||
channel: "stable",
|
||||
distributions: ["direct"],
|
||||
required: false,
|
||||
message: "Use the latest direct installer.",
|
||||
},
|
||||
manifests: [
|
||||
{
|
||||
relativeDir: join("out", "make", "squirrel.windows", "x64"),
|
||||
manifestName: "latest.yml",
|
||||
contents: `
|
||||
version: 1.5.1
|
||||
files:
|
||||
- url: Folo-1.5.1-windows-x64.exe
|
||||
sha512: ${"1".repeat(88)}
|
||||
size: 123456
|
||||
releaseDate: 2026-04-11T10:00:00.000Z
|
||||
`,
|
||||
},
|
||||
],
|
||||
})
|
||||
|
||||
const result = await buildDesktopReleaseAssets({
|
||||
projectDir,
|
||||
owner: "RSSNext",
|
||||
repo: "Folo",
|
||||
})
|
||||
|
||||
expect(result.otaMetadata.policy.distributions).toEqual({
|
||||
direct: {
|
||||
downloadUrl: "https://github.com/RSSNext/Folo/releases/tag/desktop/v1.5.1",
|
||||
},
|
||||
})
|
||||
expect(result.otaMetadata.desktop.app).toBeNull()
|
||||
expect(result.archivePath).toBeNull()
|
||||
})
|
||||
|
||||
it("fails when a desktop manifest contains an invalid file entry", async () => {
|
||||
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
|
||||
const projectDir = await createDesktopProjectFixture({
|
||||
@@ -544,9 +445,6 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
manifests: [
|
||||
{
|
||||
@@ -581,9 +479,6 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -605,9 +500,6 @@ releaseDate: 2026-04-11T10:00:00.000Z
|
||||
mode: "ota",
|
||||
runtimeVersion: "1.5.0",
|
||||
channel: "stable",
|
||||
distributions: ["direct"],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
rendererArchiveContents: "renderer archive",
|
||||
rendererManifestContents: `
|
||||
@@ -637,9 +529,6 @@ filename: custom-renderer.tar.gz
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
manifests: [
|
||||
{
|
||||
@@ -686,12 +575,9 @@ async function createDesktopProjectFixture(input: {
|
||||
version: string
|
||||
releaseConfig: {
|
||||
version: string
|
||||
mode: "build" | "ota" | "binary-policy"
|
||||
mode: "build" | "ota"
|
||||
runtimeVersion: string | null
|
||||
channel: "stable" | "beta" | "alpha" | null
|
||||
distributions: Array<"direct" | "mas" | "mss">
|
||||
required: boolean
|
||||
message: string | null
|
||||
}
|
||||
manifests?: Array<{
|
||||
relativeDir: string
|
||||
|
||||
@@ -5,9 +5,8 @@ import { readFile } from "node:fs/promises"
|
||||
import { pathToFileURL } from "node:url"
|
||||
|
||||
const SEMVER_PATTERN = /^\d+\.\d+\.\d+$/
|
||||
const VALID_MODES = new Set(["build", "ota", "binary-policy"])
|
||||
const VALID_MODES = new Set(["build", "ota"])
|
||||
const VALID_CHANNELS = new Set(["stable", "beta", "alpha"])
|
||||
const VALID_DISTRIBUTIONS = new Set(["direct", "mas", "mss"])
|
||||
|
||||
export function resolveDesktopReleaseConfig(input) {
|
||||
const normalizedReleaseVersion = input.releaseVersion.replace(/^v/, "")
|
||||
@@ -20,16 +19,7 @@ export function resolveDesktopReleaseConfig(input) {
|
||||
}
|
||||
|
||||
if (!VALID_MODES.has(config.mode)) {
|
||||
throw new Error("apps/desktop/release.json mode must be build, ota, or binary-policy.")
|
||||
}
|
||||
|
||||
if (
|
||||
!Array.isArray(config.distributions) ||
|
||||
config.distributions.some((item) => !VALID_DISTRIBUTIONS.has(item))
|
||||
) {
|
||||
throw new Error(
|
||||
"apps/desktop/release.json distributions must only contain direct, mas, or mss.",
|
||||
)
|
||||
throw new Error("apps/desktop/release.json mode must be build or ota.")
|
||||
}
|
||||
|
||||
if (config.mode === "build") {
|
||||
@@ -40,13 +30,8 @@ export function resolveDesktopReleaseConfig(input) {
|
||||
return {
|
||||
triggerDirectBuild: true,
|
||||
triggerStoreBuilds: true,
|
||||
triggerMetadataPublish: false,
|
||||
releaseKind: null,
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: "",
|
||||
required: "",
|
||||
policyMessage: "",
|
||||
releaseVersion: normalizedReleaseVersion,
|
||||
}
|
||||
}
|
||||
@@ -63,39 +48,11 @@ export function resolveDesktopReleaseConfig(input) {
|
||||
return {
|
||||
triggerDirectBuild: true,
|
||||
triggerStoreBuilds: true,
|
||||
triggerMetadataPublish: false,
|
||||
releaseKind: "ota",
|
||||
runtimeVersion: config.runtimeVersion,
|
||||
channel: config.channel,
|
||||
distributions: config.distributions.join(","),
|
||||
required: String(config.required ?? false),
|
||||
policyMessage: "",
|
||||
releaseVersion: normalizedReleaseVersion,
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.channel || !VALID_CHANNELS.has(config.channel)) {
|
||||
throw new Error("apps/desktop/release.json channel must be stable, beta, or alpha.")
|
||||
}
|
||||
|
||||
if (config.distributions.length === 0) {
|
||||
throw new Error(
|
||||
"apps/desktop/release.json binary-policy mode requires at least one distribution.",
|
||||
)
|
||||
}
|
||||
|
||||
return {
|
||||
triggerDirectBuild: false,
|
||||
triggerStoreBuilds: false,
|
||||
triggerMetadataPublish: true,
|
||||
releaseKind: "binary",
|
||||
runtimeVersion: null,
|
||||
channel: config.channel,
|
||||
distributions: config.distributions.join(","),
|
||||
required: String(config.required ?? false),
|
||||
policyMessage: config.message ?? "",
|
||||
releaseVersion: normalizedReleaseVersion,
|
||||
}
|
||||
}
|
||||
|
||||
async function readReleaseConfig(path) {
|
||||
@@ -123,13 +80,8 @@ async function main() {
|
||||
|
||||
setGitHubOutput("triggerDirectBuild", String(result.triggerDirectBuild))
|
||||
setGitHubOutput("triggerStoreBuilds", String(result.triggerStoreBuilds))
|
||||
setGitHubOutput("triggerMetadataPublish", String(result.triggerMetadataPublish))
|
||||
setGitHubOutput("releaseKind", result.releaseKind ?? "")
|
||||
setGitHubOutput("runtimeVersion", result.runtimeVersion ?? "")
|
||||
setGitHubOutput("channel", result.channel ?? "")
|
||||
setGitHubOutput("distributions", result.distributions ?? "")
|
||||
setGitHubOutput("required", result.required ?? "")
|
||||
setGitHubOutput("policyMessage", result.policyMessage ?? "")
|
||||
setGitHubOutput("releaseVersion", result.releaseVersion)
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : String(error))
|
||||
|
||||
@@ -20,21 +20,13 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerDirectBuild: true,
|
||||
triggerStoreBuilds: true,
|
||||
triggerMetadataPublish: false,
|
||||
releaseKind: null,
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: "",
|
||||
required: "",
|
||||
policyMessage: "",
|
||||
releaseVersion: "1.5.1",
|
||||
})
|
||||
})
|
||||
@@ -50,55 +42,17 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
mode: "ota",
|
||||
runtimeVersion: "1.5.0",
|
||||
channel: "stable",
|
||||
distributions: ["direct"],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerDirectBuild: true,
|
||||
triggerStoreBuilds: true,
|
||||
triggerMetadataPublish: false,
|
||||
releaseKind: "ota",
|
||||
runtimeVersion: "1.5.0",
|
||||
channel: "stable",
|
||||
distributions: "direct",
|
||||
required: "false",
|
||||
policyMessage: "",
|
||||
releaseVersion: "1.5.1",
|
||||
})
|
||||
})
|
||||
|
||||
it("triggers metadata publishing only for binary-policy mode", async () => {
|
||||
const { resolveDesktopReleaseConfig } = await import("./resolve-desktop-release-config.mjs")
|
||||
|
||||
expect(
|
||||
resolveDesktopReleaseConfig({
|
||||
releaseVersion: "v1.5.2",
|
||||
releaseConfig: {
|
||||
version: "1.5.2",
|
||||
mode: "binary-policy",
|
||||
runtimeVersion: null,
|
||||
channel: "beta",
|
||||
distributions: ["mas", "mss"],
|
||||
required: true,
|
||||
message: "Install the store binary update.",
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerDirectBuild: false,
|
||||
triggerStoreBuilds: false,
|
||||
triggerMetadataPublish: true,
|
||||
releaseKind: "binary",
|
||||
runtimeVersion: null,
|
||||
channel: "beta",
|
||||
distributions: "mas,mss",
|
||||
required: "true",
|
||||
policyMessage: "Install the store binary update.",
|
||||
releaseVersion: "1.5.2",
|
||||
})
|
||||
})
|
||||
|
||||
it("rejects a release config that does not match the release version", async () => {
|
||||
const { resolveDesktopReleaseConfig } = await import("./resolve-desktop-release-config.mjs")
|
||||
|
||||
@@ -110,9 +64,6 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
mode: "build",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toThrow(/does not match release version/i)
|
||||
@@ -129,15 +80,12 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
mode: "build",
|
||||
runtimeVersion: "1.5.1",
|
||||
channel: "stable",
|
||||
distributions: [],
|
||||
required: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toThrow(/must not set runtimeVersion or channel/i)
|
||||
})
|
||||
|
||||
it("writes GitHub outputs safely for multiline policy messages", async () => {
|
||||
it("writes GitHub outputs for ota mode", async () => {
|
||||
const projectDir = await mkdtemp(join(tmpdir(), "desktop-release-config-output-"))
|
||||
|
||||
try {
|
||||
@@ -149,12 +97,9 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
`${JSON.stringify(
|
||||
{
|
||||
version: "1.5.2",
|
||||
mode: "binary-policy",
|
||||
runtimeVersion: null,
|
||||
mode: "ota",
|
||||
runtimeVersion: "1.5.1",
|
||||
channel: "beta",
|
||||
distributions: ["mas"],
|
||||
required: true,
|
||||
message: "Install the new build.\nStore rollout is required.",
|
||||
},
|
||||
null,
|
||||
2,
|
||||
@@ -174,9 +119,12 @@ describe("resolveDesktopReleaseConfig", () => {
|
||||
|
||||
const output = await readFile(githubOutputPath, "utf8")
|
||||
|
||||
expect(output).toContain("policyMessage<<")
|
||||
expect(output).toContain("Install the new build.\nStore rollout is required.")
|
||||
expect(output).not.toContain("policyMessage=Install the new build.\n")
|
||||
expect(output).toContain("triggerDirectBuild=true")
|
||||
expect(output).toContain("triggerStoreBuilds=true")
|
||||
expect(output).toContain("runtimeVersion<<")
|
||||
expect(output).toContain("1.5.1")
|
||||
expect(output).toContain("channel<<")
|
||||
expect(output).toContain("beta")
|
||||
} finally {
|
||||
await rm(projectDir, { recursive: true, force: true })
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import { readFile } from "node:fs/promises"
|
||||
import { pathToFileURL } from "node:url"
|
||||
|
||||
const SEMVER_PATTERN = /^\d+\.\d+\.\d+$/
|
||||
const VALID_MODES = new Set(["store", "ota", "store-policy"])
|
||||
const VALID_MODES = new Set(["store", "ota"])
|
||||
const VALID_CHANNELS = new Set(["production", "preview"])
|
||||
|
||||
export function resolveMobileReleaseConfig(input) {
|
||||
@@ -19,18 +19,15 @@ export function resolveMobileReleaseConfig(input) {
|
||||
}
|
||||
|
||||
if (!VALID_MODES.has(config.mode)) {
|
||||
throw new Error("apps/mobile/release.json mode must be store, ota, or store-policy.")
|
||||
throw new Error("apps/mobile/release.json mode must be store or ota.")
|
||||
}
|
||||
|
||||
if (config.mode === "store") {
|
||||
return {
|
||||
triggerStoreBuilds: true,
|
||||
triggerOtaPublish: false,
|
||||
releaseKind: null,
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
storeRequired: null,
|
||||
policyMessage: null,
|
||||
releaseVersion: normalizedReleaseVersion,
|
||||
}
|
||||
}
|
||||
@@ -46,11 +43,8 @@ export function resolveMobileReleaseConfig(input) {
|
||||
return {
|
||||
triggerStoreBuilds: false,
|
||||
triggerOtaPublish: true,
|
||||
releaseKind: config.mode === "ota" ? "ota" : "store",
|
||||
runtimeVersion: config.runtimeVersion,
|
||||
channel: config.channel,
|
||||
storeRequired: config.mode === "store-policy" ? String(config.storeRequired ?? false) : "false",
|
||||
policyMessage: config.mode === "store-policy" ? (config.message ?? "") : "",
|
||||
releaseVersion: normalizedReleaseVersion,
|
||||
}
|
||||
}
|
||||
@@ -79,11 +73,8 @@ async function main() {
|
||||
|
||||
setGitHubOutput("trigger_store_builds", String(result.triggerStoreBuilds))
|
||||
setGitHubOutput("trigger_ota_publish", String(result.triggerOtaPublish))
|
||||
setGitHubOutput("release_kind", result.releaseKind ?? "")
|
||||
setGitHubOutput("runtime_version", result.runtimeVersion ?? "")
|
||||
setGitHubOutput("channel", result.channel ?? "")
|
||||
setGitHubOutput("store_required", result.storeRequired ?? "")
|
||||
setGitHubOutput("policy_message", result.policyMessage ?? "")
|
||||
setGitHubOutput("release_version", result.releaseVersion)
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : String(error))
|
||||
|
||||
@@ -12,18 +12,13 @@ describe("resolveMobileReleaseConfig", () => {
|
||||
mode: "store",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
storeRequired: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerStoreBuilds: true,
|
||||
triggerOtaPublish: false,
|
||||
releaseKind: null,
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
storeRequired: null,
|
||||
policyMessage: null,
|
||||
releaseVersion: "0.4.2",
|
||||
})
|
||||
})
|
||||
@@ -39,49 +34,17 @@ describe("resolveMobileReleaseConfig", () => {
|
||||
mode: "ota",
|
||||
runtimeVersion: "0.4.1",
|
||||
channel: "production",
|
||||
storeRequired: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerStoreBuilds: false,
|
||||
triggerOtaPublish: true,
|
||||
releaseKind: "ota",
|
||||
runtimeVersion: "0.4.1",
|
||||
channel: "production",
|
||||
storeRequired: "false",
|
||||
policyMessage: "",
|
||||
releaseVersion: "0.4.2",
|
||||
})
|
||||
})
|
||||
|
||||
it("triggers metadata-only publish for store-policy mode", async () => {
|
||||
const { resolveMobileReleaseConfig } = await import("./resolve-mobile-release-config.mjs")
|
||||
|
||||
expect(
|
||||
resolveMobileReleaseConfig({
|
||||
releaseVersion: "v0.4.3",
|
||||
releaseConfig: {
|
||||
version: "0.4.3",
|
||||
mode: "store-policy",
|
||||
runtimeVersion: "0.4.3",
|
||||
channel: "production",
|
||||
storeRequired: true,
|
||||
message: "Install 0.4.3 from the store.",
|
||||
},
|
||||
}),
|
||||
).toEqual({
|
||||
triggerStoreBuilds: false,
|
||||
triggerOtaPublish: true,
|
||||
releaseKind: "store",
|
||||
runtimeVersion: "0.4.3",
|
||||
channel: "production",
|
||||
storeRequired: "true",
|
||||
policyMessage: "Install 0.4.3 from the store.",
|
||||
releaseVersion: "0.4.3",
|
||||
})
|
||||
})
|
||||
|
||||
it("rejects a release config that does not match the release version", async () => {
|
||||
const { resolveMobileReleaseConfig } = await import("./resolve-mobile-release-config.mjs")
|
||||
|
||||
@@ -93,8 +56,6 @@ describe("resolveMobileReleaseConfig", () => {
|
||||
mode: "store",
|
||||
runtimeVersion: null,
|
||||
channel: null,
|
||||
storeRequired: false,
|
||||
message: null,
|
||||
},
|
||||
}),
|
||||
).toThrow(/does not match release version/i)
|
||||
|
||||
Reference in New Issue
Block a user