Files
Folo/.github/scripts/build-ota-release.test.ts
T
DIYgodanddependabot[bot] bfbce383a2 release(desktop): Release v1.6.0 (#4970)
* docs(mobile): prepare release changelog

* release(mobile): release v0.4.1

* fix(ssr): route dist-external assets (#4956)

* fix(cli): close login callback sockets (#4957)

* fix(ci): sync release branches to dev via pull request

* fix(mobile): increase ai summary font size

* fix(desktop): improve pdf export layout and branding

* fix(mobile): refresh social login state

* fix: correct French translation language detection

* build(deps): bump android-actions/setup-android from 3 to 4 (#4929)

Bumps [android-actions/setup-android](https://github.com/android-actions/setup-android) from 3 to 4.
- [Release notes](https://github.com/android-actions/setup-android/releases)
- [Commits](https://github.com/android-actions/setup-android/compare/v3...v4)

---
updated-dependencies:
- dependency-name: android-actions/setup-android
  dependency-version: '4'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(ai-chat): show reset date for future credits

* feat: refine spotlight settings and highlighting

* feat: add spotlight settings across desktop and mobile

* build(deps): bump actions/github-script from 8 to 9 (#4961)

Bumps [actions/github-script](https://github.com/actions/github-script) from 8 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v8...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump signpath/github-action-submit-signing-request (#4960)

Bumps [signpath/github-action-submit-signing-request](https://github.com/signpath/github-action-submit-signing-request) from 2.0 to 2.1.
- [Release notes](https://github.com/signpath/github-action-submit-signing-request/releases)
- [Commits](https://github.com/signpath/github-action-submit-signing-request/compare/v2.0...v2.1)

---
updated-dependencies:
- dependency-name: signpath/github-action-submit-signing-request
  dependency-version: '2.1'
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(mobile): avoid YouTube embed error on iOS close #4958

* fix(mobile): patch fmt for Xcode 26.4 builds

* build(deps): bump pnpm/action-setup from 4 to 5 (#4922)

Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 4 to 5.
- [Release notes](https://github.com/pnpm/action-setup/releases)
- [Commits](https://github.com/pnpm/action-setup/compare/v4...v5)

---
updated-dependencies:
- dependency-name: pnpm/action-setup
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(desktop): migrate tts to folo service

* docs(ota): add OTA service design spec

* feat(ota): scaffold Cloudflare worker app

* fix(ota): align scaffold with task spec

* fix(ota): use standard worker types

* fix(ota): tighten scaffold schema and dev config

* fix(ota): require at least one platform

* fix(ota): use dev env for local wrangler

* docs(ota): add implementation plan and release scoping

* chore(ota): update lockfile for worker deps

* feat(ota): add release selection primitives

* test(ota): cover incompatible newer release selection

* fix(ota): tighten release compatibility checks

* fix(ota): reject empty platform payloads

* feat(ota): add kv helpers and policy logic

* fix(ota): enforce min binary store policy

* feat(ota): fetch OTA releases from GitHub

* fix(ota): return GitHub release etags

* feat(ota): mirror release payloads into R2

* fix(ota): stream mirrored archive extraction

* fix(ota): verify mirrored asset hashes

* feat(ota): serve manifests assets and policy

* fix(ota): harden manifest and policy routes

* fix(ota): validate route semver inputs

* fix(ota): verify manifest pointer version

* feat(ota): add sync orchestration routes

* fix(ota): dedupe concurrent sync passes

* feat(mobile): enable OTA background updates

* fix(mobile): restore OTA provider typecheck

* feat(mobile): add streaming tts playback

* fix(mobile): align OTA provider state

* feat(mobile): add ota policy client and debug controls

* fix(mobile): harden ota policy and debug controls

* test(mobile): cover ota provider helpers

* ci(desktop): automate Mac App Store pkg upload

* feat(ota): generate release assets from mobile export

* test(mobile): fix ota provider test typing

* test(mobile): discover ota script test via explicit config

* fix: tighten OTA release asset metadata handling

* fix: require OTA platform asset arrays

* ci(ota): publish releases and trigger sync

* fix(ci): harden ota publish workflow

* ci(ota): tighten trailer validation

* docs(ota): add rollout and rollback runbook

* feat(mobile): upgrade expo sdk 55 and rnfirebase

* fix(ota): emit expo-compatible update identifiers

* fix(ota): support private GitHub release assets

* fix(mobile): unblock ios archive on expo sdk 55

* build(deps): bump pnpm/action-setup from 5 to 6 (#4962)

Bumps [pnpm/action-setup](https://github.com/pnpm/action-setup) from 5 to 6.
- [Release notes](https://github.com/pnpm/action-setup/releases)
- [Commits](https://github.com/pnpm/action-setup/compare/v5...v6)

---
updated-dependencies:
- dependency-name: pnpm/action-setup
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix(ci): restore ota typing and tailwind config compatibility

* test(mobile): fix ota provider test typing

* chore(ota): persist production cloudflare bindings

* fix(ci): restore semver types and ota test mocks

* feat(release): drive mobile release mode from config files

* fix(ota): sign manifests and pin runtime version

* fix(ci): disable frozen lockfile for local eas builds

* docs(spec): add desktop ota unification design

* feat(ota): unify desktop updates with ota service

* fix(ota): harden desktop sync and updater flow

* docs(skill): update desktop release workflow

* fix(release): repair ota and desktop update flows

* feat: cache storefront versions for ota policy

* feat: expose ota version badges

* feat: expose ota version badges

* fix: backfill github version badges

* fix: backfill github version badges

* docs(skills): align release modes with implementation

* fix: update Discord invite link in README.md

* fix: update macOS and Windows app store links in README.md

* fix: update GitHub badge labels in README.md

* build(deps): bump actions/download-artifact from 5 to 8 (#4969)

Bumps [actions/download-artifact](https://github.com/actions/download-artifact) from 5 to 8.
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](https://github.com/actions/download-artifact/compare/v5...v8)

---
updated-dependencies:
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* build(deps): bump softprops/action-gh-release from 2 to 3 (#4968)

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2 to 3.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v2...v3)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* docs(release): prepare desktop and mobile release metadata

* release(desktop): release v1.6.0

* fix(desktop): restore spotlight settings sync

* fix(desktop): apply spotlight highlights in entry rendering

* fix(desktop): extend spotlight highlight coverage

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-14 12:49:15 +08:00

641 lines
19 KiB
TypeScript

import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises"
import { tmpdir } from "node:os"
import { join } from "pathe"
import { afterEach, describe, expect, it } from "vitest"
type InputAsset = string | { path: string; ext?: string }
const tempDirs: string[] = []
afterEach(async () => {
await Promise.all(
tempDirs.splice(0).map((directory) => rm(directory, { recursive: true, force: true })),
)
delete process.env.OTA_RELEASE_KIND
delete process.env.OTA_RELEASE_VERSION
delete process.env.OTA_RUNTIME_VERSION
delete process.env.OTA_CHANNEL
delete process.env.OTA_PRODUCT
delete process.env.OTA_GIT_TAG
delete process.env.OTA_GIT_COMMIT
delete process.env.OTA_PUBLISHED_AT
delete process.env.OTA_STORE_REQUIRED
delete process.env.GITHUB_REPOSITORY
})
describe("buildOtaMetadata", () => {
it("preserves releaseVersion, runtimeVersion, and scoped git tag", async () => {
const { buildOtaMetadata } = await import("./build-ota-release.mjs")
const result = await buildOtaMetadata({
product: "mobile",
channel: "production",
releaseVersion: "0.4.2",
releaseKind: "ota",
runtimeVersion: "0.4.1",
gitTag: "mobile/v0.4.2",
gitCommit: "abcdef1234567890",
publishedAt: "2026-04-10T12:00:00.000Z",
policy: {
storeRequired: false,
minSupportedBinaryVersion: "0.4.1",
message: null,
},
metadata: {
fileMetadata: {
ios: {
bundle: "_expo/static/js/ios/main.hbc",
assets: [],
},
android: {
bundle: "_expo/static/js/android/main.hbc",
assets: [],
},
},
},
resolveAsset: async (asset: InputAsset) => {
const assetPath = typeof asset === "string" ? asset : asset.path
return {
path: assetPath,
sha256: `${assetPath}-sha256`.padEnd(64, "0").slice(0, 64),
contentType: "application/octet-stream",
}
},
})
expect(result.releaseVersion).toBe("0.4.2")
expect(result.runtimeVersion).toBe("0.4.1")
expect(result.git.tag).toBe("mobile/v0.4.2")
expect(result.updateId).toMatch(
/^[0-9a-f]{8}-[0-9a-f]{4}-5[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
)
})
it("uses asset ext metadata when exported asset paths have no suffix", async () => {
const { buildOtaMetadata } = await import("./build-ota-release.mjs")
const result = await buildOtaMetadata({
product: "mobile",
channel: "production",
releaseVersion: "0.4.2",
releaseKind: "ota",
runtimeVersion: "0.4.1",
gitTag: "mobile/v0.4.2",
gitCommit: "abcdef1234567890",
publishedAt: "2026-04-10T12:00:00.000Z",
policy: {
storeRequired: false,
minSupportedBinaryVersion: "0.4.1",
message: null,
},
metadata: {
fileMetadata: {
ios: {
bundle: "_expo/static/js/ios/main.hbc",
assets: [{ path: "assets/splash", ext: "png" }],
},
android: {
bundle: "_expo/static/js/android/main.hbc",
assets: [],
},
},
},
resolveAsset: async (asset: InputAsset) => {
const assetPath = typeof asset === "string" ? asset : asset.path
const ext = typeof asset === "string" ? undefined : asset.ext
return {
path: assetPath,
sha256: `${assetPath}-sha256`.padEnd(64, "0").slice(0, 64),
contentType: ext === "png" ? "image/png" : "application/octet-stream",
}
},
})
expect(result.platforms.ios.assets).toEqual([
expect.objectContaining({
path: "assets/splash",
contentType: "image/png",
}),
])
})
it("fails when a platform bundle is missing from export metadata", async () => {
const { buildOtaMetadata } = await import("./build-ota-release.mjs")
await expect(
buildOtaMetadata({
product: "mobile",
channel: "production",
releaseVersion: "0.4.2",
releaseKind: "ota",
runtimeVersion: "0.4.1",
gitTag: "mobile/v0.4.2",
gitCommit: "abcdef1234567890",
publishedAt: "2026-04-10T12:00:00.000Z",
policy: {
storeRequired: false,
minSupportedBinaryVersion: "0.4.1",
message: null,
},
metadata: {
fileMetadata: {
ios: {
bundle: "_expo/static/js/ios/main.hbc",
assets: [],
},
},
},
resolveAsset: async (asset: InputAsset) => {
const assetPath = typeof asset === "string" ? asset : asset.path
return {
path: assetPath,
sha256: `${assetPath}-sha256`.padEnd(64, "0").slice(0, 64),
contentType: "application/octet-stream",
}
},
}),
).rejects.toThrow(/android/i)
})
it("fails when a platform assets array is missing from export metadata", async () => {
const { buildOtaMetadata } = await import("./build-ota-release.mjs")
await expect(
buildOtaMetadata({
product: "mobile",
channel: "production",
releaseVersion: "0.4.2",
releaseKind: "ota",
runtimeVersion: "0.4.1",
gitTag: "mobile/v0.4.2",
gitCommit: "abcdef1234567890",
publishedAt: "2026-04-10T12:00:00.000Z",
policy: {
storeRequired: false,
minSupportedBinaryVersion: "0.4.1",
message: null,
},
metadata: {
fileMetadata: {
ios: {
bundle: "_expo/static/js/ios/main.hbc",
},
android: {
bundle: "_expo/static/js/android/main.hbc",
assets: [],
},
},
},
resolveAsset: async (asset: InputAsset) => {
const assetPath = typeof asset === "string" ? asset : asset.path
return {
path: assetPath,
sha256: `${assetPath}-sha256`.padEnd(64, "0").slice(0, 64),
contentType: "application/octet-stream",
}
},
}),
).rejects.toThrow(/ios.*assets/i)
})
it("deduplicates repeated asset entries after path normalization", async () => {
const { buildOtaMetadata } = await import("./build-ota-release.mjs")
const resolvedAssets: InputAsset[] = []
const result = await buildOtaMetadata({
product: "mobile",
channel: "production",
releaseVersion: "0.4.2",
releaseKind: "ota",
runtimeVersion: "0.4.1",
gitTag: "mobile/v0.4.2",
gitCommit: "abcdef1234567890",
publishedAt: "2026-04-10T12:00:00.000Z",
policy: {
storeRequired: false,
minSupportedBinaryVersion: "0.4.1",
message: null,
},
metadata: {
fileMetadata: {
ios: {
bundle: "_expo/static/js/ios/main.hbc",
assets: ["./assets/icon.png", { path: "assets/icon.png" }],
},
android: {
bundle: "_expo/static/js/android/main.hbc",
assets: [],
},
},
},
resolveAsset: async (asset: InputAsset) => {
resolvedAssets.push(asset)
const assetPath = typeof asset === "string" ? asset : asset.path
return {
path: assetPath,
sha256: `${assetPath}-sha256`.padEnd(64, "0").slice(0, 64),
contentType: "image/png",
}
},
})
expect(result.platforms.ios.assets).toHaveLength(1)
expect(
resolvedAssets.filter((asset) => {
const assetPath = typeof asset === "string" ? asset : asset.path
return assetPath === "assets/icon.png"
}),
).toHaveLength(1)
})
})
describe("buildReleaseAssets", () => {
it("builds metadata-only assets for store releases without Expo export output", async () => {
const { buildReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await mkdtemp(join(tmpdir(), "build-ota-release-store-test-"))
tempDirs.push(projectDir)
await writeFile(
join(projectDir, "package.json"),
JSON.stringify({ name: "@follow/mobile-test", version: "0.4.3" }),
"utf8",
)
process.env.OTA_RELEASE_KIND = "store"
process.env.OTA_RELEASE_VERSION = "0.4.3"
process.env.OTA_RUNTIME_VERSION = "0.4.3"
process.env.OTA_CHANNEL = "production"
process.env.OTA_STORE_REQUIRED = "true"
const result = await buildReleaseAssets({ projectDir })
expect(result.otaMetadata.releaseKind).toBe("store")
expect(result.otaMetadata.policy.storeRequired).toBe(true)
expect(result.otaMetadata.platforms).toEqual({})
expect(result.archivePath).toBeNull()
})
it("includes the JSON file path when export metadata cannot be parsed", async () => {
const { buildReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await mkdtemp(join(tmpdir(), "build-ota-release-test-"))
const distDir = join(projectDir, "dist")
const metadataPath = join(distDir, "metadata.json")
tempDirs.push(projectDir)
await mkdir(distDir, { recursive: true })
await writeFile(
join(projectDir, "package.json"),
JSON.stringify({ name: "@follow/mobile-test", version: "0.4.2" }),
"utf8",
)
await writeFile(metadataPath, "{invalid", "utf8")
await expect(buildReleaseAssets({ projectDir })).rejects.toThrow(metadataPath)
})
})
describe("buildDesktopReleaseAssets", () => {
it("builds schemaVersion 2 desktop build metadata with direct app payloads only", async () => {
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await createDesktopProjectFixture({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "build",
runtimeVersion: null,
channel: null,
},
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: ${"a".repeat(88)}
size: 123456
releaseDate: 2026-04-11T10:00:00.000Z
`,
},
],
})
const result = await buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
})
expect(result.otaMetadata.schemaVersion).toBe(2)
expect(result.otaMetadata.product).toBe("desktop")
expect(result.otaMetadata.releaseKind).toBe("binary")
expect(result.otaMetadata.runtimeVersion).toBeNull()
expect(result.otaMetadata.channel).toBe("stable")
expect(result.otaMetadata.desktop.renderer).toBeNull()
expect(result.otaMetadata.policy.distributions).toEqual({})
expect(result.otaMetadata.desktop.app.platforms.windows).toEqual(
expect.objectContaining({
platform: "windows-x64",
releaseDate: "2026-04-11T10:00:00.000Z",
manifest: {
name: "latest.yml",
path: "latest.yml",
downloadUrl: expect.stringContaining("/desktop/v1.5.1/latest.yml"),
},
files: [
expect.objectContaining({
filename: "Folo-1.5.1-windows-x64.exe",
sha512: "a".repeat(88),
size: 123456,
downloadUrl: expect.stringContaining("/desktop/v1.5.1/Folo-1.5.1-windows-x64.exe"),
}),
],
}),
)
expect(result.archivePath).toBeNull()
const written = JSON.parse(await readFile(result.outputPath, "utf8"))
expect(written.schemaVersion).toBe(2)
expect(written.desktop.renderer).toBeNull()
})
it("builds schemaVersion 2 desktop ota metadata with renderer and direct app payloads", async () => {
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await createDesktopProjectFixture({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "ota",
runtimeVersion: "1.5.0",
channel: "stable",
},
rendererArchiveContents: "renderer archive",
rendererManifestContents: `
version: 1.5.1
hash: ${"b".repeat(64)}
mainHash: ${"c".repeat(40)}
commit: abcdef1234567890
filename: custom-renderer.tar.gz
`,
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: ${"d".repeat(88)}
size: 654321
releaseDate: 2026-04-11T10:00:00.000Z
`,
},
],
})
const result = await buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
})
expect(result.otaMetadata.schemaVersion).toBe(2)
expect(result.otaMetadata.releaseKind).toBe("ota")
expect(result.otaMetadata.runtimeVersion).toBe("1.5.0")
expect(result.otaMetadata.channel).toBe("stable")
expect(result.otaMetadata.desktop.renderer).toEqual(
expect.objectContaining({
version: "1.5.1",
commit: "abcdef1234567890",
manifest: {
name: "manifest.yml",
downloadUrl:
"https://github.com/RSSNext/Folo/releases/download/desktop/v1.5.1/manifest.yml",
},
launchAsset: expect.objectContaining({
path: "custom-renderer.tar.gz",
contentType: "application/gzip",
}),
}),
)
expect(result.otaMetadata.desktop.renderer.launchAsset.sha256).toHaveLength(64)
expect(result.otaMetadata.desktop.app.platforms.windows.files[0]?.downloadUrl).toContain(
"/desktop/v1.5.1/Folo-1.5.1-windows-x64.exe",
)
expect(result.archivePath).not.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({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "build",
runtimeVersion: null,
channel: null,
},
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
size: 123456
releaseDate: 2026-04-11T10:00:00.000Z
`,
},
],
})
await expect(
buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
}),
).rejects.toThrow(/invalid files\[0\] entry/i)
})
it("fails for build mode when direct installer manifests are missing", async () => {
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await createDesktopProjectFixture({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "build",
runtimeVersion: null,
channel: null,
},
})
await expect(
buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
}),
).rejects.toThrow(/requires direct installer manifests/i)
})
it("fails for ota mode when direct installer manifests are missing", async () => {
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await createDesktopProjectFixture({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "ota",
runtimeVersion: "1.5.0",
channel: "stable",
},
rendererArchiveContents: "renderer archive",
rendererManifestContents: `
version: 1.5.1
hash: ${"2".repeat(64)}
mainHash: ${"3".repeat(40)}
commit: abcdef1234567890
filename: custom-renderer.tar.gz
`,
})
await expect(
buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
}),
).rejects.toThrow(/requires direct installer manifests/i)
})
it("merges duplicate desktop platform manifests instead of overwriting them", async () => {
const { buildDesktopReleaseAssets } = await import("./build-ota-release.mjs")
const projectDir = await createDesktopProjectFixture({
version: "1.5.1",
releaseConfig: {
version: "1.5.1",
mode: "build",
runtimeVersion: null,
channel: null,
},
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: ${"e".repeat(88)}
size: 123456
releaseDate: 2026-04-11T10:00:00.000Z
`,
},
{
relativeDir: join("out", "make", "squirrel.windows", "arm64"),
manifestName: "latest.yml",
contents: `
version: 1.5.1
files:
- url: Folo-1.5.1-windows-arm64.exe
sha512: ${"f".repeat(88)}
size: 234567
releaseDate: 2026-04-11T11:00:00.000Z
`,
},
],
})
const result = await buildDesktopReleaseAssets({
projectDir,
owner: "RSSNext",
repo: "Folo",
})
expect(result.otaMetadata.desktop.app.platforms.windows.files).toHaveLength(2)
expect(result.otaMetadata.desktop.app.platforms.windows.releaseDate).toBe(
"2026-04-11T11:00:00.000Z",
)
})
})
async function createDesktopProjectFixture(input: {
version: string
releaseConfig: {
version: string
mode: "build" | "ota"
runtimeVersion: string | null
channel: "stable" | "beta" | "alpha" | null
}
manifests?: Array<{
relativeDir: string
manifestName: string
contents: string
}>
rendererArchiveContents?: string
rendererManifestContents?: string
}) {
const projectDir = await mkdtemp(join(tmpdir(), "build-ota-release-desktop-test-"))
tempDirs.push(projectDir)
await writeFile(
join(projectDir, "package.json"),
JSON.stringify({ name: "@follow/desktop-test", version: input.version }),
"utf8",
)
await writeFile(
join(projectDir, "release.json"),
`${JSON.stringify(input.releaseConfig, null, 2)}\n`,
"utf8",
)
if (input.rendererArchiveContents != null || input.rendererManifestContents != null) {
await mkdir(join(projectDir, "dist"), { recursive: true })
}
if (input.rendererArchiveContents != null) {
await writeFile(
join(
projectDir,
"dist",
input.rendererManifestContents?.includes("custom-renderer.tar.gz")
? "custom-renderer.tar.gz"
: "render-asset.tar.gz",
),
input.rendererArchiveContents,
"utf8",
)
}
if (input.rendererManifestContents != null) {
await writeFile(
join(projectDir, "dist", "manifest.yml"),
input.rendererManifestContents.trimStart(),
"utf8",
)
}
for (const manifest of input.manifests ?? []) {
await mkdir(join(projectDir, manifest.relativeDir), { recursive: true })
await writeFile(
join(projectDir, manifest.relativeDir, manifest.manifestName),
manifest.contents.trimStart(),
"utf8",
)
}
return projectDir
}