diff --git a/docs/development.md b/docs/development.md index d2b497d..93381a8 100644 --- a/docs/development.md +++ b/docs/development.md @@ -38,8 +38,10 @@ for that file. 2. `.\scripts\build.ps1` builds the NSIS installer and its signed updater artifact. The updater key is read from `.tools/updater.key` (ignored; keep it safe — replacing it breaks in-app updates for existing installs) or from `TAURI_SIGNING_PRIVATE_KEY`. -3. Create the release (tag `vX.Y.Z`) and upload the files from - `src-tauri/target/release/bundle/nsis/`. +3. Commit, tag `vX.Y.Z` and push, then + `node scripts/publish-release.mjs X.Y.Z [--prerelease]` creates the Forgejo release + with the installer and its `.sig` (notes come from `CHANGELOG.md`). It reads + `FORGEJO_TOKEN` (repository read/write) from the environment or the ignored `.env`. 4. `node scripts/update-manifest.mjs X.Y.Z https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/vX.Y.Z notes.md` and commit `updates/latest.json`. Installed copies offer the update on their next start. diff --git a/scripts/publish-release.mjs b/scripts/publish-release.mjs new file mode 100644 index 0000000..111b094 --- /dev/null +++ b/scripts/publish-release.mjs @@ -0,0 +1,60 @@ +// Creates (or reuses) a Forgejo release for a tag and uploads the Windows installer and +// its updater signature. Reads FORGEJO_TOKEN from the environment or the ignored .env. +// Usage: node scripts/publish-release.mjs [--prerelease] +import fs from 'node:fs'; +import path from 'node:path'; + +const API = 'https://git.elijahkuntz.com/api/v1/repos/Elijah/Kaleido-Desktop'; +const root = path.resolve(import.meta.dirname, '..'); +const version = process.argv[2]; +const prerelease = process.argv.includes('--prerelease'); +if (!version) { + console.error('usage: node scripts/publish-release.mjs [--prerelease]'); + process.exit(1); +} + +let token = process.env.FORGEJO_TOKEN; +if (!token && fs.existsSync(path.join(root, '.env'))) { + token = fs.readFileSync(path.join(root, '.env'), 'utf8').match(/^FORGEJO_TOKEN=(.*)$/m)?.[1]?.trim().replace(/^"|"$/g, ''); +} +if (!token) { + console.error('FORGEJO_TOKEN is not set.'); + process.exit(1); +} +const headers = { Authorization: `token ${token}`, Accept: 'application/json' }; + +async function api(method, url, body) { + const r = await fetch(url.startsWith('http') ? url : API + url, { + method, + headers: body instanceof FormData ? headers : { ...headers, 'Content-Type': 'application/json' }, + body: body === undefined ? undefined : body instanceof FormData ? body : JSON.stringify(body), + }); + const text = await r.text(); + if (!r.ok) throw new Error(`${method} ${url} → ${r.status} ${text.slice(0, 300)}`); + return text ? JSON.parse(text) : null; +} + +const tag = `v${version}`; +const changelog = fs.readFileSync(path.join(root, 'CHANGELOG.md'), 'utf8'); +const section = changelog.split(/^## /m).find((s) => s.startsWith(version)); +const notes = section ? section.slice(version.length).trim() : ''; + +let release = await api('GET', `/releases/tags/${tag}`).catch(() => null); +if (!release) { + release = await api('POST', '/releases', { tag_name: tag, name: `Kaleido Desktop ${version}`, body: notes, prerelease, draft: false }); + console.log(`Created release ${release.name}`); +} else console.log(`Using existing release ${release.name}`); + +const dir = path.join(root, 'src-tauri/target/release/bundle/nsis'); +const files = [`Kaleido_${version}_x64-setup.exe`, `Kaleido_${version}_x64-setup.exe.sig`]; +for (const name of files) { + const file = path.join(dir, name); + if (!fs.existsSync(file)) throw new Error(`Missing ${file}; run scripts/build.ps1 first.`); + const existing = release.assets?.find((a) => a.name === name); + if (existing) await api('DELETE', `/releases/${release.id}/assets/${existing.id}`); + const form = new FormData(); + form.append('attachment', new Blob([fs.readFileSync(file)]), name); + const asset = await api('POST', `/releases/${release.id}/assets?name=${encodeURIComponent(name)}`, form); + console.log(`Uploaded ${asset.name} (${asset.size} bytes): ${asset.browser_download_url}`); +} +console.log(release.html_url); diff --git a/updates/latest.json b/updates/latest.json new file mode 100644 index 0000000..1dad909 --- /dev/null +++ b/updates/latest.json @@ -0,0 +1,11 @@ +{ + "platforms": { + "windows-x86_64": { + "signature": "dW50cnVzdGVkIGNvbW1lbnQ6IHNpZ25hdHVyZSBmcm9tIHRhdXJpIHNlY3JldCBrZXkKUlVURlZleWFKRzhRNUVha1JHaDZ2N1AvaFNheDNDejJKcGZUNjh3bWw5dEorRnJsN1drM0RRTkhMb24ybE9YaldGZUd3RzdYdi9qeExSaEJmRk9td1VNbm9wOGEwL3UzclFRPQp0cnVzdGVkIGNvbW1lbnQ6IHRpbWVzdGFtcDoxNzkzNDAzMTY4CWZpbGU6S2FsZWlkb18wLjEuMC1iZXRhLjFfeDY0LXNldHVwLmV4ZQl2ZXJzaW9uOjAuMS4wLWJldGEuMQo0em1GZllUakp3QVpVbVRXZllmYW1HeGtMdXhwWElreFo2dTIxMng2cC9icDNXdWtwMTlkQTNTekU2NFZEazdwZHVtUlozcmVkY0NoQ3Z4bHZDN2VCdz09Cg==", + "url": "https://git.elijahkuntz.com/Elijah/Kaleido-Desktop/releases/download/v0.1.0-beta.1/Kaleido_0.1.0-beta.1_x64-setup.exe" + } + }, + "version": "0.1.0-beta.1", + "notes": "First beta of Kaleido for Windows.\n\n- Sign in with Plex (browser or plex.tv/link) or connect to a server manually; choose a server and switch Plex Home profiles.\n- Home, Movies and TV Shows with Discover, Library and Collections; search; people; rotating featured titles with artwork colour wash.\n- Title pages with clear-logo art, Rotten Tomatoes and IMDb scores, format badges, cast and crew, extras, related titles, seasons and episodes.\n- Direct playback through mpv with hardware decoding and HDR passthrough, Plex conversion qualities, audio and subtitle selection, preview thumbnails, Skip Intro/Credits and next-episode countdown. Progress syncs with Plex.\n- Mouse and keyboard: hover previews, right-click title actions, arrow-key navigation and player shortcuts.\n- Title management: watched state, ratings, collections, playlists, metadata editing with locks, artwork, refresh, analyze, fix match, unmatch, split and delete.\n- Resumable offline downloads of movies, episodes and seasons.\n- App settings and Plex server administration: dashboard, activity, server settings, remote access, libraries, scheduled tasks, devices, troubleshooting and console.\n- Signed in-app updates.", + "pub_date": "2026-10-30T23:39:03.821Z" +}