Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(desktop): publish releases from monorepo (#78883)

Alessandro Pogliaghie875ae0a0b97
diff --git a/.github/workflows/desktop-cleanup-draft-releases.yml b/.github/workflows/desktop-cleanup-draft-releases.yml
index a1dfc623fbef..6f81e4064af6 100644
--- a/.github/workflows/desktop-cleanup-draft-releases.yml
+++ b/.github/workflows/desktop-cleanup-draft-releases.yml
@@ -22,21 +22,17 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- # Desktop release drafts live on PostHog/code (the legacy update feed), so
- # the cleanup targets that repo explicitly — never github.repository, which
- # here is the monorepo and hosts other products' drafts.
- name: Delete draft releases older than 24 hours
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
- REPO: PostHog/code
+ REPO: ${{ github.repository }}
run: |
set -o pipefail
CUTOFF=$(date -u -d "24 hours ago" +%Y-%m-%dT%H:%M:%SZ)
echo "Cutoff (UTC): $CUTOFF"
gh api --paginate "repos/$REPO/releases" \
- --jq ".[] | select(.draft == true) | select(.created_at < \"$CUTOFF\") | .id" \
+ --jq ".[] | select(.draft == true) | select(.tag_name | startswith(\"desktop-v\")) | select(.created_at < \"$CUTOFF\") | .id" \
| while read -r release_id; do
[ -z "$release_id" ] && continue
echo "Deleting draft release $release_id"
diff --git a/.github/workflows/desktop-release.yml b/.github/workflows/desktop-release.yml
index 420a11668eb0..2f450cc71438 100644
--- a/.github/workflows/desktop-release.yml
+++ b/.github/workflows/desktop-release.yml
@@ -22,7 +22,6 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- name: Extract version from tag
id: version
@@ -39,10 +38,10 @@ jobs:
# into the same release. Without this, parallel jobs each create-if-missing
# at once, producing multiple releases for one tag and scattering assets
# (the orphans get left as drafts).
- if gh release view "v$APP_VERSION" --repo PostHog/code >/dev/null 2>&1; then
- echo "Release v$APP_VERSION already exists — reusing it"
+ if gh release view "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
+ echo "Release desktop-v$APP_VERSION already exists — reusing it"
else
- gh release create "v$APP_VERSION" --repo PostHog/code --draft \
+ gh release create "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" --draft \
--title "v$APP_VERSION" --notes "Release v$APP_VERSION (build in progress)"
fi
@@ -86,7 +85,6 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -242,7 +240,7 @@ jobs:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_VERSION: ${{ steps.version.outputs.version }}
run: |
- gh release upload "v$APP_VERSION" --repo PostHog/code --clobber \
+ gh release upload "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" --clobber \
apps/code/out/*.dmg \
apps/code/out/*-mac.zip \
apps/code/out/*.blockmap
@@ -313,7 +311,6 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
@@ -419,7 +416,7 @@ jobs:
$items += Get-ChildItem $out -File -Filter "latest.yml"
$items += Get-ChildItem $out -File -Filter "*.blockmap"
$files = $items | Select-Object -ExpandProperty FullName
- gh release upload "v$env:APP_VERSION" --repo PostHog/code --clobber @files
+ gh release upload "desktop-v$env:APP_VERSION" --repo $env:GITHUB_REPOSITORY --clobber @files
- name: Configure AWS credentials for the update feed
uses: aws-actions/configure-aws-credentials@254c19bd240aabef8777f48595e9d2d7b972184b # v6.2.1
@@ -497,7 +494,6 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
@@ -599,7 +595,7 @@ jobs:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_VERSION: ${{ steps.version.outputs.version }}
run: |
- gh release upload "v$APP_VERSION" --repo PostHog/code --clobber \
+ gh release upload "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" --clobber \
apps/code/out/*.AppImage \
apps/code/out/*.deb \
apps/code/out/*.rpm
@@ -660,7 +656,6 @@ jobs:
with:
app_id: ${{ secrets.GH_APP_ARRAY_RELEASER_APP_ID }}
private_key: ${{ secrets.GH_APP_ARRAY_RELEASER_PRIVATE_KEY }}
- scope: PostHog
- name: Extract version from tag
id: version
@@ -680,6 +675,8 @@ jobs:
products/desktop/apps/code/scripts/inject-release-notes.mjs
.github/scripts/desktop/generate-release-notes.mjs
sparse-checkout-cone-mode: false
+ token: ${{ steps.app-token.outputs.token }}
+ persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
@@ -714,7 +711,7 @@ jobs:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
APP_VERSION: ${{ steps.version.outputs.version }}
run: |
- gh release upload "v$APP_VERSION" --repo PostHog/code --clobber /tmp/latest-mac.yml
+ gh release upload "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" --clobber /tmp/latest-mac.yml
- name: Download checksum artifacts
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
@@ -730,8 +727,8 @@ jobs:
run: |
CURRENT_TAG="desktop-v$APP_VERSION"
node .github/scripts/desktop/generate-release-notes.mjs "$CURRENT_TAG" > /tmp/release-notes.md
- node products/desktop/apps/code/scripts/generate-release-download-tables.mjs "$APP_VERSION" /tmp/checksums >> /tmp/release-notes.md
- gh release edit "v$APP_VERSION" --repo PostHog/code --draft=false --notes-file /tmp/release-notes.md
+ node products/desktop/apps/code/scripts/generate-release-download-tables.mjs /tmp/checksums >> /tmp/release-notes.md
+ gh release edit "desktop-v$APP_VERSION" --repo "$GITHUB_REPOSITORY" --draft=false --notes-file /tmp/release-notes.md
- name: Download windows manifest
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
@@ -739,12 +736,12 @@ jobs:
name: win-manifest
path: /tmp/win-manifest
- # Built after the GitHub release is published so the new release (and its
- # generated notes) is included; the in-app release notes read this file.
+ # Prepends this release's generated notes to the published S3 feed; the
+ # feed, not the GitHub release, is the source of truth for in-app notes.
- name: Build releases feed manifest
env:
- GH_TOKEN: ${{ steps.app-token.outputs.token }}
- run: node products/desktop/apps/code/scripts/build-releases-feed.mjs /tmp/releases.json
+ APP_VERSION: ${{ steps.version.outputs.version }}
+ run: node products/desktop/apps/code/scripts/build-releases-feed.mjs "$APP_VERSION" /tmp/release-notes.md /tmp/releases.json
# The generic provider fetches nothing from GitHub, so the channel files
# must carry the notes for electron-updater's UpdateInfo.releaseNotes.
diff --git a/products/desktop/MIGRATION.md b/products/desktop/MIGRATION.md
index d2878af15461..7a77056ae91a 100644
--- a/products/desktop/MIGRATION.md
+++ b/products/desktop/MIGRATION.md
@@ -168,10 +168,10 @@ separate project.
| test.yml | desktop-test.yml | gating: `workflow_call` child of desktop-ci.yml + `Desktop Tests Pass`; live-gateway e2e kept with `POSTHOG_CODE_E2E_*` org secrets |
| code-storybook.yml | _(not ported)_ | removed post-merge: the code-signed VR baseline flagged every story as new from this repo (see the Visual Review baseline note). Do not re-port on resync unless VR is re-registered against posthog/posthog first |
| code-build-test.yml | desktop-build-test.yml | `workflow_dispatch` only; the source's `refactor/electron-vite` push trigger is a code-repo branch and is dropped |
-| code-release.yml | desktop-release.yml | tags `desktop-v*`; legacy publishing to PostHog/code releases kept (see below) |
+| code-release.yml | desktop-release.yml | tags and GitHub releases use `desktop-v*` in PostHog/posthog; release commands use the releaser GitHub App token |
| code-tag.yml | desktop-tag.yml | computes and pushes `desktop-v*` tags; quiet-period check and patch count scoped `-- products/desktop/` (monorepo master always has fresh commits; unscoped counts would be meaningless) |
| code-update-e2e.yml | desktop-update-e2e.yml | nightly + dispatch; the source's temporary push trigger for `test/macos-auto-update-e2e` is dropped (code-repo branch, and default-only triggers exempt its caches from the cache-write lint) |
-| cleanup-draft-releases.yml | desktop-cleanup-draft-releases.yml | targets PostHog/code explicitly via the releaser app token: `github.repository` is now the monorepo, whose drafts belong to other products |
+| cleanup-draft-releases.yml | desktop-cleanup-draft-releases.yml | same-repo cleanup is restricted to draft releases whose tags start with `desktop-v` |
| agent-release.yml | desktop-agent-release.yml | sandbox rebuild dispatch is now same-repo with `actions: write` (cross-repo GH app retired) |
| agent-tag.yml | desktop-agent-tag.yml | agent tags stay `agent-v*`; patch count scoped `-- products/desktop/packages/agent` (unscoped would count every monorepo commit) |
| mobile-build.yml | desktop-mobile-build.yml | |
@@ -187,7 +187,7 @@ Dropped (the monorepo already provides the function):
| stale.yml | monorepo `stale.yaml` |
| trunk-impacted-targets.yml | code repo's Trunk merge queue does not carry over; desktop inherits the monorepo queue |
| pr-approval-agent.yml | monorepo runs its own `pr-approval-agent.yml` on all PRs |
-| code-discord-release.yml | desktop releases are published on PostHog/code (legacy feed), where the original workflow remains active; a monorepo port would fire for every other product's releases and never for desktop's |
+| code-discord-release.yml | not ported; a monorepo-wide release trigger would fire for unrelated products unless explicitly filtered to `desktop-v*` |
## Transform rules
@@ -224,15 +224,14 @@ ports from source using these rules.
- Neither the parent nor the children may take a trigger-level `paths:` filter; a required
check that never dispatches leaves the PR stuck waiting for status. Change detection
stays in each child's internal `changes` job.
-8. **Tags**: app release tags are `desktop-v*` in the monorepo (the AWS release role trusts
- `repo:PostHog/posthog:ref:refs/tags/desktop-v*`). Tag triggers, version extraction, tag
- globs and created tags all use the namespace. Agent tags stay `agent-v*`. Releases
- created **on PostHog/code** (legacy update feed) keep bare `v` names.
+8. **Tags**: app release tags and GitHub Releases are `desktop-v*` in the monorepo (the
+ AWS release role trusts `repo:PostHog/posthog:ref:refs/tags/desktop-v*`). Tag triggers,
+ version extraction, tag globs and created tags all use the namespace. Agent tags stay
+ `agent-v*`.
9. **Same-repo simplifications**: the agent-release sandbox image rebuild dispatches
`cd-sandbox-base-image.yml` with the ambient `GITHUB_TOKEN` (`actions: write`) instead
of the retired cross-repo GitHub App.
-10. **Untouched on purpose**: pinned action SHAs, secrets names, runner labels and
- `--repo PostHog/code` release publishing.
+10. **Untouched on purpose**: pinned action SHAs, secrets names and runner labels.
11. **Monorepo workflow lint** (`hogli lint:workflows`, enforced by CI; run it locally
after a resync):
- every job declares `timeout-minutes`;
@@ -274,23 +273,6 @@ ports from source using these rules.
`POSTHOG_CODE_E2E_*`) and genuinely repo-wide ones (`TRUNK_API_TOKEN`, `VR_API_TOKEN`,
`GH_APP_POSTHOG_PATHS_FILTER_*`). Reapply on resync: the source uses the bare names.
-## Intentional references still pointing at PostHog/code
-
-- `desktop-release.yml` creates and publishes GitHub releases on PostHog/code: every
- install built before the update feed moves to S3 polls that repo's releases. Publishing
- a release there auto-creates a bare `v*` tag at the old repo's frozen main; harmless,
- feed-only. This dual-publish retires once app-version telemetry shows the old feed is
- quiet. PostHog/code#3490 (S3 feed) simplifies this on its next resync into this import.
-- `desktop-cleanup-draft-releases.yml` cleans PostHog/code draft releases for the same
- reason. Both cross-repository release workflows explicitly scope their releaser app
- tokens to the PostHog organization; otherwise the token action can select a different
- installation and GitHub rejects access to PostHog/code.
-- `products/desktop/packages/agent/package.json` still declares
- `"repository": "https://github.com/PostHog/code"` (apps/code/package.json has no
- repository field). Fix it alongside the npm trusted-publisher re-registration, ideally
- upstream in PostHog/code. Other in-repo docs referencing PostHog/code are cosmetic,
- fixed opportunistically.
-
## Not done in this PR (follow-ups)
Everything that has to happen once this merges is sequenced in
diff --git a/products/desktop/POST-MIGRATION.md b/products/desktop/POST-MIGRATION.md
index 93f859ef154b..b21599ada123 100644
--- a/products/desktop/POST-MIGRATION.md
+++ b/products/desktop/POST-MIGRATION.md
@@ -168,9 +168,8 @@ publisher as posthog/posthog + that workflow, or agent releases fail at publish.
- **hogli**: done 2026-08-01. `hogli.yaml` has a `desktop:*` category, `hogli test`
routes desktop paths to Vitest and `hogli ci:preflight` validates the nested lockfile
and runs desktop's Biome.
-- **Dual-publish retirement**: `desktop-release.yml` and `desktop-cleanup-draft-releases.yml`
- still target PostHog/code for the legacy update feed. Retire once app-version telemetry
- shows the old feed is quiet.
+- **Dual-publish retirement**: done. Desktop GitHub Releases and draft cleanup now use
+ `PostHog/posthog`; application updates continue to use the S3/CloudFront feed.
- **Dependency tail**: the remaining transitive high/moderate advisories (minimatch,
picomatch, js-yaml, form-data, svgo) are left for a dedicated dependency-hygiene sweep.
Note automated patching does not cover this tree: see the standing security-patch
diff --git a/products/desktop/README.md b/products/desktop/README.md
index 589ab320d03d..3e7489c5c0df 100644
--- a/products/desktop/README.md
+++ b/products/desktop/README.md
@@ -1,9 +1,9 @@
> [!IMPORTANT]
> Interested in the PostHog desktop app? [Join the waitlist](https://posthog.com/code) or hop into our [Discord](https://discord.gg/aSrHKVNVdR).
-**[Download the latest version](https://github.com/PostHog/code/releases/latest)**
+**[Download the latest version](https://github.com/PostHog/posthog/releases?q=desktop-v)**
-Found a bug or want to share feedback? [Open an issue](https://github.com/PostHog/code/issues/new) on GitHub.
+Found a bug or want to share feedback? [Open an issue](https://github.com/PostHog/posthog/issues/new) on GitHub.
# PostHog
diff --git a/products/desktop/apps/code/electron-builder.ts b/products/desktop/apps/code/electron-builder.ts
index 70bd5102ad90..03c49356cc36 100644
--- a/products/desktop/apps/code/electron-builder.ts
+++ b/products/desktop/apps/code/electron-builder.ts
@@ -133,9 +133,7 @@ const config: Configuration = {
},
// Installs built from this config poll the CloudFront-fronted update feed
- // (the S3 bucket is private; reads go through the CDN). Installs built before
- // the feed moved poll GitHub Releases on PostHog/code, so CI dual-publishes
- // there until that fleet drains.
+ // (the S3 bucket is private; reads go through the CDN).
publish: {
provider: "generic",
url: "https://desktop-releases.posthog.com/stable",
diff --git a/products/desktop/apps/code/scripts/build-releases-feed.mjs b/products/desktop/apps/code/scripts/build-releases-feed.mjs
index d8e1cee996b9..cf4da2a67a78 100644
--- a/products/desktop/apps/code/scripts/build-releases-feed.mjs
+++ b/products/desktop/apps/code/scripts/build-releases-feed.mjs
@@ -1,45 +1,57 @@
#!/usr/bin/env node
-import { realpathSync, writeFileSync } from "node:fs";
+import { readFileSync, realpathSync, writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
-const RELEASES_API_URL =
- "https://api.github.com/repos/PostHog/code/releases?per_page=30";
+const FEED_URL = "https://desktop-releases.posthog.com/stable/releases.json";
+const MAX_RELEASES = 30;
-export function toFeedReleases(apiReleases) {
- return apiReleases
- .filter((release) => !release.draft)
- .map((release) => ({
- version: release.tag_name.replace(/^v/, ""),
- name:
- release.name && release.name.length > 0
- ? release.name
- : release.tag_name,
- notes: release.body ?? "",
- date: release.published_at,
- isPrerelease: release.prerelease,
- htmlUrl: release.html_url,
- }));
+export function mergeRelease(existingReleases, entry) {
+ return [
+ entry,
+ ...existingReleases.filter((release) => release.version !== entry.version),
+ ].slice(0, MAX_RELEASES);
}
-async function main() {
- const [, , outputPath] = process.argv;
-
- if (!outputPath) {
- console.error("Usage: build-releases-feed.mjs <output-json>");
- process.exit(1);
+export async function fetchExistingReleases(fetchImpl = fetch) {
+ const response = await fetchImpl(FEED_URL, {
+ headers: { Accept: "application/json" },
+ });
+ // A feed that has never been published surfaces as 403/404 from CloudFront.
+ if (response.status === 403 || response.status === 404) {
+ console.warn(
+ `Release feed fetch returned ${response.status}; starting an empty feed`,
+ );
+ return [];
}
-
- const headers = { Accept: "application/vnd.github+json" };
- if (process.env.GH_TOKEN) {
- headers.Authorization = `Bearer ${process.env.GH_TOKEN}`;
+ if (!response.ok) {
+ throw new Error(`Release feed fetch failed: ${response.status}`);
+ }
+ const data = await response.json();
+ if (!Array.isArray(data?.releases)) {
+ // Rebuilding from an empty base would wipe the published history.
+ throw new Error("Release feed response has no releases array");
}
+ return data.releases;
+}
- const response = await fetch(RELEASES_API_URL, { headers });
- if (!response.ok) {
- throw new Error(`GitHub releases fetch failed: ${response.status}`);
+async function main() {
+ const [, , version, notesPath, outputPath] = process.argv;
+
+ if (!version || !notesPath || !outputPath) {
+ console.error(
+ "Usage: build-releases-feed.mjs <version> <notes-file> <output-json>",
+ );
+ process.exit(1);
}
- const releases = toFeedReleases(await response.json());
+ const releases = mergeRelease(await fetchExistingReleases(), {
+ version,
+ name: `v${version}`,
+ notes: readFileSync(notesPath, "utf8"),
+ date: new Date().toISOString(),
+ isPrerelease: false,
+ htmlUrl: `https://github.com/PostHog/posthog/releases/tag/desktop-v${version}`,
+ });
writeFileSync(
outputPath,
`${JSON.stringify({ releases }, null, 2)}\n`,
diff --git a/products/desktop/apps/code/scripts/build-releases-feed.test.mjs b/products/desktop/apps/code/scripts/build-releases-feed.test.mjs
new file mode 100644
index 000000000000..21f2c5dc241b
--- /dev/null
+++ b/products/desktop/apps/code/scripts/build-releases-feed.test.mjs
@@ -0,0 +1,98 @@
+import { describe, expect, it, vi } from "vitest";
+import { fetchExistingReleases, mergeRelease } from "./build-releases-feed.mjs";
+
+const entry = (version, overrides = {}) => ({
+ version,
+ name: `v${version}`,
+ notes: `Notes for ${version}`,
+ date: "2026-08-06T00:00:00Z",
+ isPrerelease: false,
+ htmlUrl: `https://github.com/PostHog/posthog/releases/tag/desktop-v${version}`,
+ ...overrides,
+});
+
+const response = (body, status = 200) => ({
+ ok: status >= 200 && status < 300,
+ status,
+ json: async () => body,
+});
+
+describe("mergeRelease", () => {
+ it("prepends the new release to the existing feed", () => {
+ const merged = mergeRelease(
+ [entry("0.60.57"), entry("0.60.56")],
+ entry("0.60.58"),
+ );
+
+ expect(merged.map(({ version }) => version)).toEqual([
+ "0.60.58",
+ "0.60.57",
+ "0.60.56",
+ ]);
+ });
+
+ it("replaces an existing entry on a re-run of the same version", () => {
+ const merged = mergeRelease(
+ [entry("0.60.58", { notes: "stale" }), entry("0.60.57")],
+ entry("0.60.58", { notes: "fresh" }),
+ );
+
+ expect(merged.map(({ version }) => version)).toEqual([
+ "0.60.58",
+ "0.60.57",
+ ]);
+ expect(merged[0].notes).toBe("fresh");
+ });
+
+ it("caps the feed at the 30 newest releases", () => {
+ const existing = Array.from({ length: 40 }, (_, index) =>
+ entry(`0.60.${40 - index}`),
+ );
+
+ const merged = mergeRelease(existing, entry("0.60.41"));
+
+ expect(merged).toHaveLength(30);
+ expect(merged[0].version).toBe("0.60.41");
+ expect(merged[29].version).toBe("0.60.12");
+ });
+});
+
+describe("fetchExistingReleases", () => {
+ it("returns the published releases", async () => {
+ const fetchImpl = vi
+ .fn()
+ .mockResolvedValue(response({ releases: [entry("0.60.57")] }));
+
+ const releases = await fetchExistingReleases(fetchImpl);
+
+ expect(releases.map(({ version }) => version)).toEqual(["0.60.57"]);
+ });
+
+ it.each([[403], [404]])(
+ "treats a %i (feed never published) as an empty feed",
+ async (status) => {
+ const fetchImpl = vi.fn().mockResolvedValue(response(null, status));
+
+ await expect(fetchExistingReleases(fetchImpl)).resolves.toEqual([]);
+ },
+ );
+
+ it("throws on other fetch failures instead of wiping history", async () => {
+ const fetchImpl = vi.fn().mockResolvedValue(response(null, 500));
+
+ await expect(fetchExistingReleases(fetchImpl)).rejects.toThrow(
+ "Release feed fetch failed: 500",
+ );
+ });
+
+ it.each([[{}], [{ releases: null }], [null]])(
+ "throws on a 200 response without a releases array (%o) instead of wiping history",
+ async (body) => {
+ const fetchImpl = vi.fn().mockResolvedValue(response(body));
+
+ await expect(fetchExistingReleases(fetchImpl)).rejects.toThrow(
+ "Release feed response has no releases array",
+ );
+ },
+ );
+});
diff --git a/products/desktop/apps/code/scripts/generate-release-download-tables.mjs b/products/desktop/apps/code/scripts/generate-release-download-tables.mjs
index d117d6e868bb..61ffeb4f3391 100644
--- a/products/desktop/apps/code/scripts/generate-release-download-tables.mjs
+++ b/products/desktop/apps/code/scripts/generate-release-download-tables.mjs
@@ -1,14 +1,15 @@
#!/usr/bin/env node
-// Renders the "Downloads" section appended to GitHub release notes: one
+// Renders the "Downloads" section appended to the release notes: one
// markdown table per OS with a direct download link, blockmap link, and
// SHA-256 per installer. Input is a directory of sha256sum/shasum output
-// files collected from the publish jobs in code-release.yml — the asset
+// files collected from the publish jobs in desktop-release.yml — the asset
// patterns below must cover every file those jobs checksum.
import { readdirSync, readFileSync, realpathSync } from "node:fs";
import { join } from "node:path";
import { fileURLToPath } from "node:url";
-const DOWNLOAD_BASE = "https://github.com/PostHog/code/releases/download";
+// The S3 update feed is flat; filenames carry the version.
+const DOWNLOAD_BASE = "https://desktop-releases.posthog.com/stable";
const ASSET_KINDS = [
{ pattern: /-mac\.dmg$/, os: "macos", pkg: "DMG", pkgOrder: 0 },
@@ -69,8 +70,8 @@ function detectArch(name) {
return "unknown";
}
-export function buildDownloadTables(version, checksums) {
- const base = `${DOWNLOAD_BASE}/v${version.replace(/^v/, "")}`;
+export function buildDownloadTables(checksums) {
+ const base = DOWNLOAD_BASE;
const rows = { macos: [], windows: [], linux: [] };
for (const [name, sha] of checksums) {
@@ -131,11 +132,11 @@ export function buildDownloadTables(version, checksums) {
}
function main() {
- const [, , version, checksumsDir] = process.argv;
+ const [, , checksumsDir] = process.argv;
- if (!version || !checksumsDir) {
+ if (!checksumsDir) {
console.error(
- "Usage: generate-release-download-tables.mjs <version> <checksums-dir>",
+ "Usage: generate-release-download-tables.mjs <checksums-dir>",
);
process.exit(1);
}
@@ -157,7 +158,7 @@ function main() {
}
}
- const markdown = buildDownloadTables(version, checksums);
+ const markdown = buildDownloadTables(checksums);
if (!markdown) {
console.error(`No release artifacts found in ${checksumsDir}`);
process.exit(1);
diff --git a/products/desktop/apps/code/scripts/generate-release-download-tables.test.mjs b/products/desktop/apps/code/scripts/generate-release-download-tables.test.mjs
index 6eb98ee95051..04a4817595c5 100644
--- a/products/desktop/apps/code/scripts/generate-release-download-tables.test.mjs
+++ b/products/desktop/apps/code/scripts/generate-release-download-tables.test.mjs
@@ -69,7 +69,7 @@ describe("parseChecksums", () => {
describe("buildDownloadTables", () => {
it("renders one section per OS, in macOS/Windows/Linux order", () => {
- const markdown = buildDownloadTables("0.56.90", releaseChecksums());
+ const markdown = buildDownloadTables(releaseChecksums());
const headings = markdown
.split("\n")
@@ -83,20 +83,20 @@ describe("buildDownloadTables", () => {
});
it("orders macOS by arch (Apple Silicon first) and Linux by package", () => {
- const markdown = buildDownloadTables("0.56.90", releaseChecksums());
+ const markdown = buildDownloadTables(releaseChecksums());
expect(downloadCells(markdown)).toEqual([
- "[PostHog-Code-0.56.90-arm64-mac.dmg](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-arm64-mac.dmg)",
- "[PostHog-Code-0.56.90-arm64-mac.zip](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-arm64-mac.zip)",
- "[PostHog-Code-0.56.90-x64-mac.dmg](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x64-mac.dmg)",
- "[PostHog-Code-0.56.90-x64-mac.zip](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x64-mac.zip)",
- "[PostHog-Code-0.56.90-x64-win.exe](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x64-win.exe)",
- "[PostHog-Code-0.56.90-x86_64-linux.AppImage](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x86_64-linux.AppImage)",
- "[PostHog-Code-0.56.90-arm64-linux.AppImage](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-arm64-linux.AppImage)",
- "[PostHog-Code-0.56.90-amd64-linux.deb](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-amd64-linux.deb)",
- "[PostHog-Code-0.56.90-arm64-linux.deb](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-arm64-linux.deb)",
- "[PostHog-Code-0.56.90-x86_64-linux.rpm](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x86_64-linux.rpm)",
- "[PostHog-Code-0.56.90-aarch64-linux.rpm](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-aarch64-linux.rpm)",
+ "[PostHog-Code-0.56.90-arm64-mac.dmg](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-arm64-mac.dmg)",
+ "[PostHog-Code-0.56.90-arm64-mac.zip](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-arm64-mac.zip)",
+ "[PostHog-Code-0.56.90-x64-mac.dmg](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x64-mac.dmg)",
+ "[PostHog-Code-0.56.90-x64-mac.zip](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x64-mac.zip)",
+ "[PostHog-Code-0.56.90-x64-win.exe](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x64-win.exe)",
+ "[PostHog-Code-0.56.90-x86_64-linux.AppImage](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x86_64-linux.AppImage)",
+ "[PostHog-Code-0.56.90-arm64-linux.AppImage](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-arm64-linux.AppImage)",
+ "[PostHog-Code-0.56.90-amd64-linux.deb](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-amd64-linux.deb)",
+ "[PostHog-Code-0.56.90-arm64-linux.deb](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-arm64-linux.deb)",
+ "[PostHog-Code-0.56.90-x86_64-linux.rpm](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x86_64-linux.rpm)",
+ "[PostHog-Code-0.56.90-aarch64-linux.rpm](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-aarch64-linux.rpm)",
]);
});
@@ -104,11 +104,11 @@ describe("buildDownloadTables", () => {
[
"links the blockmap when present",
"arm64-mac.dmg](",
- "[blockmap](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-arm64-mac.dmg.blockmap)",
+ "[blockmap](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-arm64-mac.dmg.blockmap)",
],
["shows a dash when the blockmap is absent", "amd64-linux.deb](", "| — |"],
])("%s", (_label, rowFragment, expected) => {
- const rows = tableRows(buildDownloadTables("0.56.90", releaseChecksums()));
+ const rows = tableRows(buildDownloadTables(releaseChecksums()));
const row = rows.find((line) => line.includes(rowFragment));
expect(row).toContain(expected);
@@ -116,14 +116,14 @@ describe("buildDownloadTables", () => {
it("abbreviates the sha to 6 digits with the full hash as hover tooltip", () => {
const checksums = releaseChecksums();
- const markdown = buildDownloadTables("0.56.90", checksums);
+ const markdown = buildDownloadTables(checksums);
const exeRow = markdown
.split("\n")
.find((line) => line.includes("x64-win.exe]("));
const fullSha = checksums.get("PostHog-Code-0.56.90-x64-win.exe");
expect(exeRow).toContain(
- `[\`${fullSha.slice(0, 6)}\`](https://github.com/PostHog/code/releases/download/v0.56.90/PostHog-Code-0.56.90-x64-win.exe "${fullSha}")`,
+ `[\`${fullSha.slice(0, 6)}\`](https://desktop-releases.posthog.com/stable/PostHog-Code-0.56.90-x64-win.exe "${fullSha}")`,
);
expect(exeRow).not.toContain(`\`${fullSha}\``);
});
@@ -131,7 +131,7 @@ describe("buildDownloadTables", () => {
it("does not render blockmaps or unrecognized files as rows", () => {
const checksums = releaseChecksums();
checksums.set("latest-mac.yml", sha("c"));
- const markdown = buildDownloadTables("0.56.90", checksums);
+ const markdown = buildDownloadTables(checksums);
expect(markdown).not.toContain("latest-mac.yml");
expect(markdown).not.toContain(
@@ -139,20 +139,13 @@ describe("buildDownloadTables", () => {
);
});
- it("accepts a version with a leading v without doubling it in URLs", () => {
- const markdown = buildDownloadTables("v0.56.90", releaseChecksums());
-
- expect(markdown).toContain("/releases/download/v0.56.90/");
- expect(markdown).not.toContain("vv0.56.90");
- });
-
it("labels macOS architectures and skips empty sections", () => {
const macOnly = new Map([
["PostHog-Code-1.2.3-arm64-mac.dmg", sha("a")],
["PostHog-Code-1.2.3-x64-mac.dmg", sha("b")],
]);
- const markdown = buildDownloadTables("1.2.3", macOnly);
+ const markdown = buildDownloadTables(macOnly);
expect(markdown).toContain("Apple Silicon (arm64)");
expect(markdown).toContain("Intel (x64)");
@@ -161,6 +154,6 @@ describe("buildDownloadTables", () => {
});
it("returns an empty string when there are no recognized artifacts", () => {
- expect(buildDownloadTables("1.2.3", new Map())).toBe("");
+ expect(buildDownloadTables(new Map())).toBe("");
});
});
diff --git a/products/desktop/docs/UPDATES.md b/products/desktop/docs/UPDATES.md
index 4b9207e6d497..a0a5b3fad40c 100644
--- a/products/desktop/docs/UPDATES.md
+++ b/products/desktop/docs/UPDATES.md
@@ -15,9 +15,9 @@ The version in `apps/code/package.json` is set to `0.0.0-dev` - this is intentio
PostHog uses [electron-updater](https://www.electron.build/auto-update) (the npm package, not the built-in Electron autoUpdater) with the generic provider. On startup the app checks for updates against the update feed at `https://desktop-releases.posthog.com/stable`, baked into `app-update.yml` inside the app bundle at package time.
-Release CI uploads the binaries and blockmaps to the feed from each platform job, then the finalize job uploads the channel files (`latest-mac.yml`, `latest.yml`) last. Updaters only see a release once the channel files change, so that upload is the publish step. The finalize job also injects the generated release notes into the channel files (the generic provider fetches nothing from GitHub, so `UpdateInfo.releaseNotes` comes from the manifest) and publishes `releases.json`, which powers the in-app release notes and What's New history.
+Release CI uploads the binaries and blockmaps to the feed from each platform job, then the finalize job uploads the channel files (`latest-mac.yml`, `latest.yml`) last. Updaters only see a release once the channel files change, so that upload is the publish step. The finalize job also injects the generated release notes into the channel files (the generic provider fetches nothing from GitHub, so `UpdateInfo.releaseNotes` comes from the manifest) and publishes `releases.json`, which powers the in-app release notes and What's New history. `releases.json` is built by prepending this release's generated notes to the previously published feed, so the S3 feed (not the GitHub releases API) is the source of truth for in-app notes.
-**Dual publish**: installs built before the feed moved to S3 poll GitHub Releases on PostHog/code, so CI keeps uploading the same artifacts and manifests there until that fleet drains. The GitHub release also remains the human-facing changelog and download page.
+GitHub Releases in `PostHog/posthog` remain the human-facing changelog and download page. Desktop releases use the existing `desktop-v*` tag namespace so they remain distinct from other monorepo products.
**macOS**: DMG + zip artifacts are uploaded; the merged `latest-mac.yml` covers both arm64 and x64 so the correct build is selected per architecture.