feat(release): one-command desktop release with Ed25519-signed update metadata
The installer is unsigned, so latest.yml is now signed with an Ed25519 key and the app verifies the downloaded installer against it before installing. npm run release -- patch|minor bumps, gates, tags, builds, signs, publishes, re-verifies the public feed and pushes; --resume continues after a failure. The retired GitLab registry publisher is removed.
This commit is contained in:
parent
f5ae4c8c04
commit
fd9c97b7cc
21 changed files with 986 additions and 144 deletions
|
|
@ -1,15 +1,13 @@
|
|||
name: release
|
||||
|
||||
# Canonical tag-triggered desktop release built and published on Forgejo.
|
||||
# GitLab CI (.gitlab-ci.yml) is the legacy mirror builder; both converge on
|
||||
# publish-forgejo-release.mjs so the Forgejo feed is the single update source.
|
||||
# 태그(vX.Y.Z) 데스크톱 릴리스 — 로컬 `npm run release` 와 같은 스크립트를 쓰는 예비 경로.
|
||||
# 보통은 로컬 명령이 빌드·게시까지 끝낸 뒤 태그를 푸시하므로, 피드에 이미 그 버전이 있으면 건너뛴다.
|
||||
#
|
||||
# Required repository secrets:
|
||||
# Required repository secrets (npm run release:secrets 로 .env 에서 동기화):
|
||||
# FORGEJO_TOKEN — PAT with write:package + write:repository
|
||||
# WIN_CSC_LINK — base64 Authenticode PFX (public-trust)
|
||||
# WIN_CSC_KEY_PASSWORD — PFX password
|
||||
# WIN_CSC_EXPECTED_SIGNER_SUBJECT — exact certificate subject
|
||||
# Release fails closed when signing material is absent.
|
||||
# D3RO_UPDATE_SIGNING_KEY — latest.yml Ed25519 서명 키 (없으면 게시 실패)
|
||||
# Optional (Authenticode — 있으면 설치본에 서명, 없으면 무서명 + Ed25519 메타데이터 서명):
|
||||
# WIN_CSC_LINK, WIN_CSC_KEY_PASSWORD
|
||||
|
||||
on:
|
||||
push:
|
||||
|
|
@ -37,46 +35,30 @@ jobs:
|
|||
run: |
|
||||
node scripts/ci/sync-version.mjs --check --tag "$env:GITHUB_REF_NAME"
|
||||
|
||||
- name: 이미 게시됐는지 확인
|
||||
id: feed
|
||||
run: |
|
||||
$releaseVersion = node -p "require('./release/product-version.json').version"
|
||||
$url = "https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/$releaseVersion/latest.yml"
|
||||
try { Invoke-WebRequest -Uri $url -Method Get -UseBasicParsing | Out-Null; $published = 'true' } catch { $published = 'false' }
|
||||
"published=$published" >> $env:GITHUB_OUTPUT
|
||||
if ($published -eq 'true') { Write-Host "$releaseVersion 는 이미 피드에 있습니다 — 건너뜁니다." }
|
||||
|
||||
- name: 의존성 설치
|
||||
if: steps.feed.outputs.published != 'true'
|
||||
run: npm ci
|
||||
|
||||
- name: STT 사이드카 빌드 (로컬 전사 엔진)
|
||||
run: |
|
||||
# 로컬 전사는 faster-whisper 사이드카에 의존한다. 이 번들이 빠지면
|
||||
# 설치본에서 전사가 전혀 동작하지 않으므로 패키징 전에 반드시 빌드/검증한다.
|
||||
npm run sidecar:setup --workspace=@d3ro/desktop
|
||||
npm run sidecar:build --workspace=@d3ro/desktop
|
||||
node scripts/ci/verify-sidecar-bundle.mjs
|
||||
|
||||
- name: 데스크톱 빌드 (서명 필수)
|
||||
- name: 설치본 빌드
|
||||
if: steps.feed.outputs.published != 'true'
|
||||
env:
|
||||
WIN_CSC_LINK: "${{ secrets.WIN_CSC_LINK }}"
|
||||
WIN_CSC_KEY_PASSWORD: "${{ secrets.WIN_CSC_KEY_PASSWORD }}"
|
||||
WIN_CSC_EXPECTED_SIGNER_SUBJECT: "${{ secrets.WIN_CSC_EXPECTED_SIGNER_SUBJECT }}"
|
||||
run: |
|
||||
if (-not $env:WIN_CSC_LINK -or -not $env:WIN_CSC_KEY_PASSWORD) {
|
||||
throw "WIN_CSC_LINK / WIN_CSC_KEY_PASSWORD 가 없으면 stable 릴리스를 게시할 수 없습니다."
|
||||
}
|
||||
if ($env:WIN_CSC_EXPECTED_SIGNER_SUBJECT -match '(?i)Everything2EverythingDev') {
|
||||
throw "로컬 개발 인증서는 production 서명 identity가 아닙니다."
|
||||
}
|
||||
npm run build --workspace=@d3ro/desktop
|
||||
node scripts/ci/verify-desktop-renderer-bundles.mjs
|
||||
Push-Location apps/desktop
|
||||
npx electron-builder --win --x64 --config electron-builder.yml --publish never
|
||||
node scripts/ci/verify-native-abi.mjs
|
||||
Pop-Location
|
||||
run: node scripts/ci/build-desktop-installer.mjs
|
||||
|
||||
- name: Windows 산출물 검증
|
||||
env:
|
||||
WIN_CSC_EXPECTED_SIGNER_SUBJECT: "${{ secrets.WIN_CSC_EXPECTED_SIGNER_SUBJECT }}"
|
||||
run: |
|
||||
$releaseVersion = node -p "require('./release/product-version.json').version"
|
||||
& scripts/ci/verify-windows-release-artifact.ps1 -ExpectedVersion $releaseVersion -ExpectedSignerSubject $env:WIN_CSC_EXPECTED_SIGNER_SUBJECT -ReleaseDirectory "apps/desktop/release/$releaseVersion"
|
||||
|
||||
- name: Forgejo 릴리스 + feed 게시
|
||||
- name: Forgejo 피드 게시 (latest.yml Ed25519 서명 + 공개 URL 검증)
|
||||
if: steps.feed.outputs.published != 'true'
|
||||
env:
|
||||
FORGEJO_TOKEN: "${{ secrets.FORGEJO_TOKEN }}"
|
||||
D3RO_UPDATE_SIGNING_KEY: "${{ secrets.D3RO_UPDATE_SIGNING_KEY }}"
|
||||
FORGEJO_REPO: "${{ github.server_url }}/${{ github.repository }}"
|
||||
run: |
|
||||
node scripts/ci/publish-forgejo-release.mjs
|
||||
run: node scripts/ci/publish-forgejo-release.mjs
|
||||
|
|
|
|||
|
|
@ -495,9 +495,8 @@ publish-release:
|
|||
artifacts: false
|
||||
optional: true
|
||||
script:
|
||||
# canonical: Forgejo feed + release hub. legacy mirror: GitLab registry.
|
||||
# canonical: Forgejo feed + release hub (GitLab registry 미러는 2026-10 폐기).
|
||||
- node scripts/ci/publish-forgejo-release.mjs
|
||||
- node scripts/ci/publish-gitlab-release.mjs
|
||||
rules:
|
||||
- if: '$CI_COMMIT_TAG =~ /^v\d+\.\d+\.\d+.*$/'
|
||||
|
||||
|
|
|
|||
52
AGENTS.md
52
AGENTS.md
|
|
@ -116,12 +116,27 @@ Full procedure and templates: [`docs/map/12-update-protocol.md`](./docs/map/12-u
|
|||
|
||||
## 6. Update & release system
|
||||
|
||||
Desktop auto-update runs `electron-updater` against the **canonical Forgejo feed**
|
||||
Desktop auto-update runs `electron-updater` against the **Forgejo feed**
|
||||
`https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest`.
|
||||
The GitLab project 1172 registry is a **legacy mirror** for pre-Forgejo installs;
|
||||
runtime must never point at it. Full evaluation and 2026 methodology:
|
||||
The installer is unsigned (no Authenticode yet), so `latest.yml` is signed with an
|
||||
**Ed25519 key** and the app verifies the downloaded installer against it before
|
||||
installing (`apps/desktop/src/main/update-signature.ts`). The GitLab registry mirror
|
||||
was retired in 2026-10. Full evaluation:
|
||||
[`docs/deployment/update-system-assessment.md`](./docs/deployment/update-system-assessment.md).
|
||||
|
||||
**To ship a desktop release, run one command on `main` with a clean tree:**
|
||||
|
||||
```bash
|
||||
npm run release -- patch # fix → 1.9.0 → 1.9.1
|
||||
npm run release -- minor # feat → 1.9.0 → 1.10.0
|
||||
npm run release -- --resume # continue after a failed build/publish/push
|
||||
```
|
||||
|
||||
It bumps the version, drafts the CHANGELOG section if missing (write it by hand first
|
||||
for user-facing notes), runs the gates, commits + tags, builds, signs, publishes,
|
||||
re-verifies the public feed, then pushes. Existing installs pick it up on their next
|
||||
check (15 s after launch, then every 4 h).
|
||||
|
||||
These files move together and are enforced by `npm run release:metadata:test`:
|
||||
|
||||
| Concern | SSOT |
|
||||
|
|
@ -130,8 +145,10 @@ These files move together and are enforced by `npm run release:metadata:test`:
|
|||
| builder publish URL | `apps/desktop/electron-builder.yml` |
|
||||
| update policy (channels, min version, force, delta/full, rollout, kill switch) | `release/update-policy.json` |
|
||||
| policy runtime logic | `apps/desktop/src/main/update-policy.ts` |
|
||||
| canonical publisher | `scripts/ci/publish-forgejo-release.mjs` |
|
||||
| legacy mirror publisher | `scripts/ci/publish-gitlab-release.mjs` |
|
||||
| one-command release | `scripts/ci/release-desktop.mjs` (`npm run release`) |
|
||||
| installer build | `scripts/ci/build-desktop-installer.mjs` |
|
||||
| publisher (sign + upload + verify) | `scripts/ci/publish-forgejo-release.mjs` |
|
||||
| update signing key | `.env` `D3RO_UPDATE_SIGNING_KEY` (private) · `release/desktop-update-public.pem` == `update-signature.ts` |
|
||||
| version SSOT | `release/product-version.json` |
|
||||
|
||||
Rules:
|
||||
|
|
@ -139,8 +156,12 @@ Rules:
|
|||
- **Tag-only, immutable releases.** Publish runs only on annotated `vX.Y.Z` tags.
|
||||
Tags are never moved or deleted; a bad release is fixed forward with a higher
|
||||
patch. Same-version re-release is forbidden by SemVer.
|
||||
- **Feed contract.** `UPDATE_FEED_URL` == builder `publish.url` == canonical
|
||||
Forgejo URL. `LEGACY_UPDATE_FEED_URL` must stay the GitLab mirror.
|
||||
- **Feed contract.** `UPDATE_FEED_URL` == builder `publish.url` == Forgejo URL.
|
||||
The app verifies against the immutable `<version>/latest.yml` + `.sig`, never the
|
||||
mutable `latest` alias.
|
||||
- **Never rotate or lose the update signing key.** Installs that embed its public key
|
||||
reject releases signed by any other key; the only recovery is a manual reinstall.
|
||||
Back up `.env`.
|
||||
- **Version discipline.** SemVer: `feat`=MINOR, `fix`=PATCH, breaking=MAJOR. Run
|
||||
`npm run version:sync` when syncing surfaces; `npm run version:check` must be clean.
|
||||
- **Channels.** `latest` (stable), `beta`, `alpha`. Stable clients never receive a
|
||||
|
|
@ -150,15 +171,16 @@ Rules:
|
|||
full installer instead of a blockmap delta (`fullInstallOnMajorChange`,
|
||||
`fullInstallVersionGap`). `stagingPercentage` limits rollout; `killSwitch` stops
|
||||
update checks remotely.
|
||||
- **Secrets stay fail-closed.** Every publisher needs `FORGEJO_TOKEN`
|
||||
(`write:package` + `write:repository`). Desktop releases additionally require the
|
||||
`WIN_CSC_*` Authenticode material; missing signing data must fail the pipeline.
|
||||
- **Secrets stay fail-closed.** Publishing needs `FORGEJO_TOKEN`
|
||||
(`write:package` + `write:repository`) and `D3RO_UPDATE_SIGNING_KEY`; a missing or
|
||||
mismatched signing key fails before any upload. `WIN_CSC_*` Authenticode material is
|
||||
optional — when present electron-builder also signs the installer.
|
||||
- **CI is the backup path.** `.forgejo/workflows/release.yml` runs on the pushed tag
|
||||
with the same build/publish scripts and skips when the feed already has the version
|
||||
(the normal case after `npm run release`). Sync secrets with `npm run release:secrets`.
|
||||
|
||||
Commands: `npm run release:metadata`, `npm run release:metadata:test`,
|
||||
`npm run release:forgejo:check`, `npm run release:tag -- --dry-run` (then
|
||||
`npm run release:tag`, then `git push origin vX.Y.Z`). Use `--sign` when GPG is
|
||||
configured; tags are annotated and immutable. Locally, `npm run release:forgejo:local`
|
||||
loads `FORGEJO_TOKEN` from `.env` (gitignored); CI reads the secret from its store.
|
||||
Other commands: `npm run release -- minor --dry-run`, `npm run release:build`,
|
||||
`npm run release:metadata:test`, `npm run release:forgejo:check`.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
13
CLAUDE.md
13
CLAUDE.md
|
|
@ -44,12 +44,13 @@ Phase 1~15.5 전체 완료 + 랜딩 페이지(site/).
|
|||
차단 이슈: @nut-tree-fork/nut-js 포크 사용
|
||||
|
||||
## 업데이트 / 릴리스
|
||||
자동 업데이트는 electron-updater + **canonical Forgejo feed**
|
||||
(`git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest`). GitLab project 1172은
|
||||
legacy mirror다. 채널·최소 지원 버전·강제 업데이트·증분/전체·staged rollout·킬 스위치는
|
||||
`release/update-policy.json`이 정본이다. 릴리스는 annotated `vX.Y.Z` 태그에서만 게시하며
|
||||
태그는 불변이다. 규칙은 `AGENTS.md` §6, 평가·방법론은
|
||||
`docs/deployment/update-system-assessment.md` 참조.
|
||||
자동 업데이트는 electron-updater + Forgejo feed
|
||||
(`git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest`). 설치본은 무서명이라
|
||||
latest.yml 을 Ed25519 로 서명하고 앱이 받은 설치 파일을 검증한다(`update-signature.ts`).
|
||||
**릴리스 = `npm run release -- patch|minor` 한 줄** (main, 깨끗한 트리, .env 의 FORGEJO_TOKEN ·
|
||||
D3RO_UPDATE_SIGNING_KEY). 실패하면 `npm run release -- --resume`. 채널·최소 지원 버전·
|
||||
강제 업데이트·rollout·킬 스위치는 `release/update-policy.json`이 정본. 태그는 불변.
|
||||
규칙은 `AGENTS.md` §6.
|
||||
|
||||
## 설계 문서 (구현 시 Read 도구로 참조)
|
||||
- docs/design/00-master-architecture.md — 시스템 아키텍처, 초기화/종료, 서비스 목록
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@
|
|||
"drizzle-orm": "^0.45.2",
|
||||
"electron-log": "^5.2.0",
|
||||
"electron-store": "^10.0.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"electron-updater": "^6.8.10",
|
||||
"koffi": "^3.3.1",
|
||||
"lucide-react": "^1.25.0",
|
||||
"overlayscrollbars": "^2.16.0",
|
||||
|
|
|
|||
|
|
@ -8,7 +8,8 @@ import { app, dialog } from 'electron'
|
|||
import { getLogger } from './LoggerService'
|
||||
import { configGet } from './ConfigService'
|
||||
import { getMainWindow } from '../windows/WindowManager'
|
||||
import { UPDATE_FEED_URL, UPDATE_POLICY_URL } from '../update-feed'
|
||||
import { UPDATE_FEED_URL, UPDATE_POLICY_URL, versionedManifestUrl } from '../update-feed'
|
||||
import { verifyDownloadedUpdate } from '../update-signature'
|
||||
import { DEFAULT_UPDATE_POLICY, parseUpdatePolicy, type UpdatePolicy } from '../update-policy'
|
||||
import { PORTABLE_INSTALL_MARKER, detectInstallKind, type InstallProbe } from '../install-kind'
|
||||
import type {
|
||||
|
|
@ -24,6 +25,41 @@ const logger = getLogger('UpdateService')
|
|||
|
||||
/** 원격 정책 fetch 타임아웃 */
|
||||
const POLICY_FETCH_TIMEOUT_MS = 8_000
|
||||
/** 서명된 latest.yml fetch 타임아웃 */
|
||||
const MANIFEST_FETCH_TIMEOUT_MS = 15_000
|
||||
|
||||
async function fetchText(url: string): Promise<string> {
|
||||
const response = await fetch(url, { cache: 'no-store', signal: AbortSignal.timeout(MANIFEST_FETCH_TIMEOUT_MS) })
|
||||
if (!response.ok) throw new Error(`HTTP ${response.status} ${url}`)
|
||||
return response.text()
|
||||
}
|
||||
|
||||
/**
|
||||
* NsisUpdater 는 받은 파일을 넘기기 전에 `verifySignature(path)` 를 부르고, 문자열을 돌려받으면
|
||||
* 파일을 지우고 ERR_UPDATER_INVALID_SIGNATURE 로 실패한다. 무서명 앱에선 이 단계가 아무것도 안 하므로
|
||||
* 우리 Ed25519 검증으로 바꿔 끼운다. 라이브러리가 이 지점을 없애면 업데이트를 받지 않는다(fail-closed).
|
||||
*/
|
||||
function installManifestVerifier(
|
||||
updater: import('electron-updater').AppUpdater,
|
||||
offeredVersion: () => string | null,
|
||||
): boolean {
|
||||
const target = updater as unknown as { verifySignature?: (path: string) => Promise<string | null> }
|
||||
if (typeof target.verifySignature !== 'function') return false
|
||||
target.verifySignature = async (installerPath: string): Promise<string | null> => {
|
||||
const version = offeredVersion()
|
||||
if (!version) return '받으려던 버전을 알 수 없음'
|
||||
const rejection = await verifyDownloadedUpdate({
|
||||
version,
|
||||
installerPath,
|
||||
fetchText,
|
||||
manifestUrl: versionedManifestUrl(version),
|
||||
})
|
||||
if (rejection) logger.error(`업데이트 v${version} 설치 거부 — ${rejection}`)
|
||||
else logger.info(`업데이트 v${version} 서명 확인 완료`)
|
||||
return rejection
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
/** 실행 중인 설치본의 형태를 파일 시스템에서 읽는다 (판단은 detectInstallKind). */
|
||||
function probeInstall(): InstallProbe {
|
||||
|
|
@ -74,6 +110,13 @@ export function createElectronUpdater(handlers: UpdaterEventHandlers): UpdaterPo
|
|||
return null
|
||||
}
|
||||
|
||||
let offeredVersion: string | null = null
|
||||
// macOS 는 Squirrel.Mac 이 앱 코드 서명을 직접 요구하므로 이 검증은 Windows(NSIS) 전용이다.
|
||||
if (process.platform === 'win32' && !installManifestVerifier(updater, () => offeredVersion)) {
|
||||
logger.error('electron-updater 에 설치 파일 검증 지점(verifySignature)이 없음 — 자동 업데이트 비활성')
|
||||
return null
|
||||
}
|
||||
|
||||
updater.setFeedURL({ provider: 'generic', url: UPDATE_FEED_URL })
|
||||
// 사용자 인가를 위해 자동 다운로드는 비활성화 (동의 시 downloadUpdate 호출)
|
||||
updater.autoDownload = false
|
||||
|
|
@ -87,7 +130,10 @@ export function createElectronUpdater(handlers: UpdaterEventHandlers): UpdaterPo
|
|||
}
|
||||
|
||||
updater.on('checking-for-update', () => handlers.onChecking())
|
||||
updater.on('update-available', (info) => handlers.onAvailable(info))
|
||||
updater.on('update-available', (info) => {
|
||||
offeredVersion = info.version
|
||||
handlers.onAvailable(info)
|
||||
})
|
||||
updater.on('update-not-available', (info) => handlers.onNotAvailable(info.version))
|
||||
updater.on('download-progress', (progress) =>
|
||||
handlers.onProgress({
|
||||
|
|
|
|||
|
|
@ -24,11 +24,13 @@ export const RUNTIME_FEED_URL = UPDATE_FEED_URL.replace(/\/latest$/, '/runtime-l
|
|||
/** 런타임 인덱스 파일명 (feed 루트) — RuntimeProvisioner 가 `${RUNTIME_FEED_URL}/${RUNTIME_INDEX_FILENAME}` 으로 읽는다 */
|
||||
export const RUNTIME_INDEX_FILENAME = 'runtime.json'
|
||||
|
||||
// GitLab Generic Registry legacy mirror. 2026-08 이전 설치본(0.2.1-alpha)은
|
||||
// 이 feed를 폴링하므로, 새 설치자가 Forgejo feed를 내장할 때까지 publisher가
|
||||
// 함께 게시한다. 마이그레이션 완료 후 제거 가능. 런타임은 참조하지 않는다.
|
||||
export const LEGACY_UPDATE_FEED_URL =
|
||||
'https://gitlab.twentyoz.kr:8443/api/v4/projects/1172/packages/generic/d3ro-voice/latest'
|
||||
/**
|
||||
* 버전별(불변) 경로의 latest.yml. 서명 검증은 `latest`(가변) 대신 이 경로를 본다 —
|
||||
* 받는 사이에 새 버전이 게시돼 latest.yml 이 바뀌어도 검증 대상이 흔들리지 않는다.
|
||||
*/
|
||||
export function versionedManifestUrl(version: string): string {
|
||||
return `${UPDATE_FEED_URL.replace(/\/latest$/, '')}/${encodeURIComponent(version)}/latest.yml`
|
||||
}
|
||||
|
||||
/** 업데이트 채널. `latest`=stable, `beta`, `alpha` 순으로 불안정. */
|
||||
export type UpdateChannel = 'latest' | 'beta' | 'alpha'
|
||||
|
|
|
|||
91
apps/desktop/src/main/update-signature.ts
Normal file
91
apps/desktop/src/main/update-signature.ts
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
// src/main/update-signature.ts
|
||||
// 받은 업데이트 설치 파일이 우리가 게시한 것인지 확인한다.
|
||||
//
|
||||
// 설치본에 Authenticode 서명이 없어 electron-updater 는 자체 서명 검증을 건너뛴다. 그러면 피드
|
||||
// (Forgejo 패키지)가 털렸을 때 아무 설치 파일이나 배포된다. 그래서 게시 스크립트가 latest.yml 을
|
||||
// 오프라인 Ed25519 키로 서명하고(latest.yml.sig), 앱은:
|
||||
// 1. 버전별(불변) 경로의 latest.yml + .sig 를 받아 내장 공개키로 서명을 확인하고
|
||||
// 2. 그 latest.yml 의 version · sha512 가 받은 설치 파일과 같은지 본다.
|
||||
// 하나라도 어긋나면 설치를 거부한다(fail-closed). 게시 쪽: scripts/ci/lib/update-manifest-signature.mjs
|
||||
|
||||
import { createHash, createPublicKey, verify } from 'node:crypto'
|
||||
import { createReadStream } from 'node:fs'
|
||||
|
||||
/** release/desktop-update-public.pem 사본 — verify-release-metadata 가 둘이 같은지 검사한다 */
|
||||
export const UPDATE_SIGNING_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
||||
MCowBQYDK2VwAyEAlvJTkVr7CSi9ZbBL2JOub7Sw4CAc1WOJpLEjDs/V/8o=
|
||||
-----END PUBLIC KEY-----
|
||||
`
|
||||
|
||||
export const UPDATE_SIGNATURE_SUFFIX = '.sig'
|
||||
|
||||
const ED25519_SIGNATURE_BYTES = 64
|
||||
|
||||
export interface SignedManifestInput {
|
||||
manifest: string
|
||||
signature: string
|
||||
publicKeyPem?: string
|
||||
}
|
||||
|
||||
/** 서명이 맞으면 latest.yml 의 version/sha512 를, 아니면 null 을 돌려준다 */
|
||||
export function readSignedManifest({
|
||||
manifest,
|
||||
signature,
|
||||
publicKeyPem = UPDATE_SIGNING_PUBLIC_KEY,
|
||||
}: SignedManifestInput): { version: string; sha512: string } | null {
|
||||
const signatureBytes = Buffer.from(signature.trim(), 'base64')
|
||||
if (signatureBytes.length !== ED25519_SIGNATURE_BYTES) return null
|
||||
let valid = false
|
||||
try {
|
||||
valid = verify(null, Buffer.from(manifest, 'utf8'), createPublicKey(publicKeyPem), signatureBytes)
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
if (!valid) return null
|
||||
// 서명된 내용이라 신뢰할 수 있다 — 최상위 키만 읽으면 된다(files[] 아래 들여쓴 줄은 제외).
|
||||
const version = manifest.match(/^version:\s*['"]?([^'"\s]+)['"]?\s*$/m)?.[1]
|
||||
const sha512 = manifest.match(/^sha512:\s*['"]?([^'"\s]+)['"]?\s*$/m)?.[1]
|
||||
return version && sha512 ? { version, sha512 } : null
|
||||
}
|
||||
|
||||
export function sha512Base64OfFile(path: string): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const hash = createHash('sha512')
|
||||
createReadStream(path)
|
||||
.on('data', (chunk) => hash.update(chunk))
|
||||
.on('end', () => resolve(hash.digest('base64')))
|
||||
.on('error', reject)
|
||||
})
|
||||
}
|
||||
|
||||
export interface VerifyDownloadInput {
|
||||
/** 사용자에게 제안했던(받으려던) 버전 */
|
||||
version: string
|
||||
installerPath: string
|
||||
fetchText(url: string): Promise<string>
|
||||
manifestUrl: string
|
||||
publicKeyPem?: string
|
||||
hashFile?: (path: string) => Promise<string>
|
||||
}
|
||||
|
||||
/** 통과하면 null, 거부하면 사유 문자열 (electron-updater verifySignature 계약과 같다) */
|
||||
export async function verifyDownloadedUpdate(input: VerifyDownloadInput): Promise<string | null> {
|
||||
let manifest: string
|
||||
let signature: string
|
||||
try {
|
||||
;[manifest, signature] = await Promise.all([
|
||||
input.fetchText(input.manifestUrl),
|
||||
input.fetchText(`${input.manifestUrl}${UPDATE_SIGNATURE_SUFFIX}`),
|
||||
])
|
||||
} catch (err) {
|
||||
return `서명된 업데이트 메타데이터를 받지 못함: ${err instanceof Error ? err.message : String(err)}`
|
||||
}
|
||||
const signed = readSignedManifest({ manifest, signature, publicKeyPem: input.publicKeyPem })
|
||||
if (!signed) return 'latest.yml 서명이 유효하지 않음'
|
||||
if (signed.version !== input.version) {
|
||||
return `서명된 버전(${signed.version})이 받은 버전(${input.version})과 다름`
|
||||
}
|
||||
const actual = await (input.hashFile ?? sha512Base64OfFile)(input.installerPath)
|
||||
if (actual !== signed.sha512) return '설치 파일 sha512 가 서명된 latest.yml 과 다름'
|
||||
return null
|
||||
}
|
||||
107
apps/desktop/tests/main/update-signature.test.ts
Normal file
107
apps/desktop/tests/main/update-signature.test.ts
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
import { createHash, generateKeyPairSync, sign } from 'node:crypto'
|
||||
import { mkdtempSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { tmpdir } from 'node:os'
|
||||
import { join } from 'node:path'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import {
|
||||
UPDATE_SIGNING_PUBLIC_KEY,
|
||||
readSignedManifest,
|
||||
sha512Base64OfFile,
|
||||
verifyDownloadedUpdate,
|
||||
} from '../../src/main/update-signature'
|
||||
import { versionedManifestUrl } from '../../src/main/update-feed'
|
||||
|
||||
const { privateKey, publicKey } = generateKeyPairSync('ed25519')
|
||||
const publicKeyPem = publicKey.export({ type: 'spki', format: 'pem' }).toString()
|
||||
|
||||
function fixture(version = '1.10.0') {
|
||||
const dir = mkdtempSync(join(tmpdir(), 'd3ro-update-sig-'))
|
||||
const installerPath = join(dir, 'setup.exe')
|
||||
writeFileSync(installerPath, `installer bytes ${version}`)
|
||||
const sha512 = createHash('sha512').update(readFileSync(installerPath)).digest('base64')
|
||||
const manifest = [
|
||||
`version: ${version}`,
|
||||
'files:',
|
||||
` - url: D3RO-Voice-Setup-${version}-x64.exe`,
|
||||
` sha512: ${sha512}`,
|
||||
' size: 22',
|
||||
`path: D3RO-Voice-Setup-${version}-x64.exe`,
|
||||
`sha512: ${sha512}`,
|
||||
"releaseDate: '2026-10-17T00:00:00.000Z'",
|
||||
'',
|
||||
].join('\n')
|
||||
const signature = sign(null, Buffer.from(manifest), privateKey).toString('base64')
|
||||
return { installerPath, manifest, signature, sha512 }
|
||||
}
|
||||
|
||||
function fetcher(files: Record<string, string>) {
|
||||
return async (url: string): Promise<string> => {
|
||||
const name = url.endsWith('.sig') ? 'sig' : 'manifest'
|
||||
const body = files[name]
|
||||
if (body === undefined) throw new Error(`HTTP 404 ${url}`)
|
||||
return body
|
||||
}
|
||||
}
|
||||
|
||||
describe('update-signature', () => {
|
||||
it('reads version and sha512 from a correctly signed manifest', () => {
|
||||
const { manifest, signature, sha512 } = fixture()
|
||||
expect(readSignedManifest({ manifest, signature, publicKeyPem })).toEqual({ version: '1.10.0', sha512 })
|
||||
})
|
||||
|
||||
it('rejects a tampered manifest, a foreign key, and a malformed signature', () => {
|
||||
const { manifest, signature } = fixture()
|
||||
expect(readSignedManifest({ manifest: manifest.replace('1.10.0', '9.9.9'), signature, publicKeyPem })).toBeNull()
|
||||
expect(readSignedManifest({ manifest, signature, publicKeyPem: UPDATE_SIGNING_PUBLIC_KEY })).toBeNull()
|
||||
expect(readSignedManifest({ manifest, signature: 'not-a-signature', publicKeyPem })).toBeNull()
|
||||
})
|
||||
|
||||
it('accepts the downloaded installer only when manifest, version and hash all match', async () => {
|
||||
const { installerPath, manifest, signature } = fixture()
|
||||
const base = { version: '1.10.0', installerPath, manifestUrl: 'https://feed/1.10.0/latest.yml', publicKeyPem }
|
||||
await expect(verifyDownloadedUpdate({ ...base, fetchText: fetcher({ manifest, sig: signature }) })).resolves.toBeNull()
|
||||
|
||||
await expect(
|
||||
verifyDownloadedUpdate({ ...base, version: '1.11.0', fetchText: fetcher({ manifest, sig: signature }) }),
|
||||
).resolves.toMatch(/버전/)
|
||||
|
||||
writeFileSync(installerPath, 'swapped installer')
|
||||
await expect(verifyDownloadedUpdate({ ...base, fetchText: fetcher({ manifest, sig: signature }) })).resolves.toMatch(
|
||||
/sha512/,
|
||||
)
|
||||
})
|
||||
|
||||
it('fails closed when the signature file is missing', async () => {
|
||||
const { installerPath, manifest } = fixture()
|
||||
await expect(
|
||||
verifyDownloadedUpdate({
|
||||
version: '1.10.0',
|
||||
installerPath,
|
||||
manifestUrl: 'https://feed/1.10.0/latest.yml',
|
||||
publicKeyPem,
|
||||
fetchText: fetcher({ manifest }),
|
||||
}),
|
||||
).resolves.toMatch(/받지 못함/)
|
||||
})
|
||||
|
||||
it('hashes files as base64 sha512 like electron-builder', async () => {
|
||||
const { installerPath, sha512 } = fixture()
|
||||
await expect(sha512Base64OfFile(installerPath)).resolves.toBe(sha512)
|
||||
})
|
||||
|
||||
it('embeds the same public key as release/desktop-update-public.pem', () => {
|
||||
const pem = readFileSync(join(__dirname, '../../../../release/desktop-update-public.pem'), 'utf8')
|
||||
expect(UPDATE_SIGNING_PUBLIC_KEY.trim()).toBe(pem.trim())
|
||||
})
|
||||
|
||||
it('verifies against the immutable versioned path, not the mutable latest alias', () => {
|
||||
expect(versionedManifestUrl('1.10.0')).toBe(
|
||||
'https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/1.10.0/latest.yml',
|
||||
)
|
||||
})
|
||||
|
||||
it('keeps the electron-updater hook this verifier replaces', async () => {
|
||||
const { NsisUpdater } = await import('electron-updater')
|
||||
expect(typeof (NsisUpdater.prototype as unknown as { verifySignature?: unknown }).verifySignature).toBe('function')
|
||||
})
|
||||
})
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
# D3RO Voice 릴리스 가이드
|
||||
|
||||
기준일: 2026-09-18. 이 문서는 desktop GitLab 패키지·자동 업데이트와 mobile store release의 경계를 분리한다. 태그 생성이나 HTTP 200 하나만으로 배포 완료를 선언하지 않는다.
|
||||
기준일: 2026-10-17. 이 문서는 desktop 자동 업데이트(Forgejo feed)와 mobile store release의 경계를 분리한다. 태그 생성이나 HTTP 200 하나만으로 배포 완료를 선언하지 않는다.
|
||||
|
||||
## 현재 release identity
|
||||
|
||||
|
|
@ -12,38 +12,62 @@
|
|||
| Android upload key | alias `d3ro-upload-20260821`, cert SHA-256 `4F:AC:69:24:...:15:2B:54` | external PKCS12·user-only ACL·Credential Manager·private-key readback GREEN; CI secret·복구 백업·AAB signer 대조 대기 |
|
||||
| release evidence | Ed25519 public `release/mobile-release-evidence-public.pem`, keyId `2797d3e6...4a890b7f` | external private key ACL·roundtrip GREEN; CI private-key secret·복구 백업 대기 |
|
||||
| desktop offline license | Ed25519 public `apps/desktop/resources/license/production-public.pem`, keyId `5c52b765...81a887f` | 새 전용 keypair·external private ACL·roundtrip·desktop production build GREEN; admin `ADMIN_LICENSE_PRIVATE_KEY` secret 주입 대기 |
|
||||
| Windows Authenticode | external public-trust code-signing certificate | production PFX 없음. Forgejo 저장소 시크릿 4종(`WIN_CSC_LINK`/`WIN_CSC_KEY_PASSWORD`/`WIN_CSC_EXPECTED_SIGNER_SUBJECT`/`FORGEJO_TOKEN`)이 0건이라 릴리스 파이프라인이 fail-closed. `scripts/ci/set-forgejo-secrets.mjs --check`로 확인한다. GREEN 전까지 게시 금지 |
|
||||
| Windows Authenticode | external public-trust code-signing certificate | production PFX 없음(한국 개인은 Azure Artifact Signing 불가, 사업자면 가능). 2026-10-17부터 **선택 사항** — 없으면 무서명 설치본 + Ed25519 서명 `latest.yml` 로 게시하고 앱이 검증한다 |
|
||||
| 업데이트 서명 키 | Ed25519 public `release/desktop-update-public.pem` (== `apps/desktop/src/main/update-signature.ts`), private = `.env` `D3RO_UPDATE_SIGNING_KEY` | 2026-10-17 생성. **교체·분실 금지** — 이 공개키를 내장한 설치본은 다른 키로 서명된 릴리스를 거부한다. `.env` 백업 필수 |
|
||||
| Firebase | Console `u/0`, `u/1` 모두 D3RO project 없음 | 사용자 승인 후 project·Android app 생성 필요 |
|
||||
| AdMob | app `ca-app-pub-1039714767792854~6427959892`; banner `/9840591290`; rewarded `/2255790918` | SSOT 확정. `검토 필요`·`광고 게재 제한`·store 미연결·결제 프로필 미완료 |
|
||||
| updater feed (canonical) | `https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest` | Forgejo Generic Registry. GitLab project 1172은 legacy mirror |
|
||||
| updater feed (canonical) | `https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest` | Forgejo Generic Registry. GitLab 미러는 2026-10-17 폐기 |
|
||||
| release notes | `CHANGELOG.md` `## [1.5.0]` + Play changelog `1050000.txt` (ko/en) | 태그 전 확정·검증 필수 |
|
||||
| 직전 게시본 | Forgejo Generic Registry `1.6.0` (2026-09-24 게시, unsigned installer + runtime/portable) | `v1.2.0`·`v1.3.0` 파이프라인은 서명/사이드카 선행 조건에서 실패했고 `v1.4.0`은 게시되지 않았다. `1.3.2`·`1.3.7`·`1.5.0`·`1.6.0`은 무서명 로컬 게시 경로(GAP-REL-06)를 사용했다 |
|
||||
|
||||
live canonical feed(`git.chanpaca.net/.../d3ro-voice/latest`)의 `latest.yml`은 현재 `1.6.0`을 보고한다(2026-09-24 무서명 로컬 게시). `runtime-latest/runtime.json`과 `portable-latest/portable.json`도 `1.6.0`이다. 서명 인증서를 확보하면 이보다 높은 버전을 서명 게시해 대체한다.
|
||||
|
||||
## desktop 릴리스 파이프라인
|
||||
## desktop 릴리스 = 한 줄 명령 (2026-10-17~)
|
||||
|
||||
```text
|
||||
authoritative release commit
|
||||
→ version/check/test/build GREEN
|
||||
→ annotated tag v1.3.0
|
||||
→ package-windows (build-win-x64)
|
||||
→ package-macos (build-mac-arm64)
|
||||
→ publish-release (build-linux-x64)
|
||||
├─ publish-forgejo-release.mjs ← canonical
|
||||
│ ├─ Forgejo Generic Registry /d3ro-voice/1.3.0/ (버전별 보존)
|
||||
│ ├─ Forgejo Generic Registry /d3ro-voice/latest/ (updater feed + update-policy.json)
|
||||
│ └─ Forgejo Release + CHANGELOG notes + 자산 첨부
|
||||
└─ publish-gitlab-release.mjs ← legacy mirror (pre-Forgejo 설치본)
|
||||
├─ GitLab Generic Registry /d3ro-voice/1.3.0/
|
||||
├─ GitLab Generic Registry /d3ro-voice/latest/
|
||||
└─ GitLab Release
|
||||
```bash
|
||||
npm run release -- patch # fix 1.9.0 → 1.9.1
|
||||
npm run release -- minor # feat 1.9.0 → 1.10.0
|
||||
npm run release -- minor --dry-run # 할 일만 출력
|
||||
npm run release -- --resume # 빌드·게시·푸시 중 실패 후 이어 가기
|
||||
```
|
||||
|
||||
- Forgejo·GitHub Actions도 동일한 `publish-forgejo-release.mjs`로 수렴한다. 어느
|
||||
빌더가 성공해도 canonical feed는 하나다.
|
||||
- `publish-forgejo-release.mjs`는 설치 자산을 먼저, `latest.yml`을 마지막에
|
||||
게시하고, 공개 URL에서 재검증한 뒤 Release 자산을 첨부한다.
|
||||
전제: `main`, 깨끗한 작업 트리, 루트 `.env` 의 `FORGEJO_TOKEN` · `D3RO_UPDATE_SIGNING_KEY`.
|
||||
사용자에게 보일 변경점은 미리 `CHANGELOG.md` `## [x.y.z] - 날짜` 로 써 두는 게 좋다(없으면
|
||||
커밋 제목으로 초안을 만든다). 모바일 Play '새 기능' 문구 파일이 없으면 일반 문구로 채운다.
|
||||
|
||||
```text
|
||||
scripts/ci/release-desktop.mjs
|
||||
1. 점검 main · 깨끗한 트리 · 토큰 · 서명 키가 저장소 공개키와 짝 · 태그/피드 미사용
|
||||
2. 버전 product-version.json + sync-version --write + CHANGELOG + Play 문구
|
||||
3. 게이트 version:check · release:metadata · typecheck
|
||||
4. 커밋 chore(release): vX.Y.Z + annotated 태그 (로컬)
|
||||
5. 빌드 build-desktop-installer.mjs (electron-vite → unpacked → ABI 보정·검증 → app-update.yml → NSIS, 100MiB 한도)
|
||||
6. 게시 publish-forgejo-release.mjs
|
||||
├─ latest.yml → latest.yml.sig (Ed25519)
|
||||
├─ /d3ro-voice/<version>/ 불변, 다른 바이트면 중단
|
||||
├─ /d3ro-voice/latest/ 설치 자산 먼저, 메타데이터·정책 마지막
|
||||
├─ 공개 URL 의 <version>/latest.yml + .sig 를 다시 받아 서명·설치본 sha512 검증
|
||||
└─ Forgejo Release + CHANGELOG 노트
|
||||
7. 푸시 chanpaca main + 태그 (origin 미러는 실패해도 경고)
|
||||
```
|
||||
|
||||
- CI(`.forgejo/workflows/release.yml`)는 같은 빌드·게시 스크립트를 쓰는 **예비 경로**다. 태그가
|
||||
푸시되면 돌지만 피드에 이미 그 버전이 있으면(보통) 건너뛴다. 시크릿: `FORGEJO_TOKEN`,
|
||||
`D3RO_UPDATE_SIGNING_KEY`(필수), `WIN_CSC_*`(선택) — `npm run release:secrets` 로 `.env` 에서 동기화.
|
||||
- 런타임(사이드카/ffmpeg)을 바꿨으면 먼저 `npm run release:portable:build` → `npm run release:portable`.
|
||||
게시 스크립트는 `runtime-latest` 가 이 빌드의 최소 런타임을 만족하지 않으면 아무것도 올리지 않는다.
|
||||
|
||||
### 앱 쪽 검증 (무서명 설치본 보호)
|
||||
|
||||
electron-updater 는 Authenticode 서명이 없으면 자체 검증을 건너뛴다. 그래서
|
||||
`update-adapters.ts` 가 NsisUpdater 의 `verifySignature` 단계를 `verifyDownloadedUpdate`
|
||||
(`update-signature.ts`)로 바꿔 끼운다: 불변 경로 `<version>/latest.yml` + `.sig` 를 받아 내장
|
||||
공개키로 서명을 확인하고, 그 version·sha512 가 받은 설치 파일과 같아야 설치한다. 하나라도
|
||||
어긋나면 electron-updater 가 파일을 지우고 `ERR_UPDATER_INVALID_SIGNATURE` 로 실패한다.
|
||||
1.9.0 이하 설치본은 이 검증이 없지만 새 릴리스를 그대로 받는다(서명 파일이 추가될 뿐).
|
||||
|
||||
### 공통 규칙
|
||||
|
||||
- 설치 바이너리는 저장소에 커밋하지 않는다. 배포 정본은 Forgejo feed이며,
|
||||
`site/public/releases/*/`, `apps/web/public/releases/*/`는 `.gitignore`로
|
||||
막혀 있어 build graph 밖이고 배포 산출물에 포함되지 않는다(추적 상태로 남아
|
||||
|
|
@ -55,7 +79,7 @@ authoritative release commit
|
|||
- `scripts/ci/sync-version.mjs --check --tag v1.3.0`는 태그, `release/product-version.json`, package/lockfile, Android/iOS 버전 면의 일치를 fail-closed로 검증한다.
|
||||
- `scripts/ci/verify-release-metadata.mjs`는 배포 메타데이터와 CI/publisher 계약을 검증한다.
|
||||
- 같은 gate는 desktop license public key가 Ed25519이고 `release/product-version.json`의 `desktopLicensePublicKeyId`와 일치하는지 검증한다. `electron.vite.config.ts`는 이 파일을 직접 읽으므로 누락·손상된 키로는 build가 시작되지 않는다.
|
||||
- `scripts/ci/publish-forgejo-release.mjs`는 canonical이다. 버전별 패키지를 먼저 올리고, `latest`에서 설치 자산 참조를 검증한 뒤 `latest.yml`과 `update-policy.json`을 마지막에 게시하고 공개 URL에서 재검증한다. `scripts/ci/publish-gitlab-release.mjs`는 legacy mirror로 동일 자산을 GitLab에도 올린다.
|
||||
- `scripts/ci/publish-forgejo-release.mjs`가 유일한 게시 경로다. 버전별 패키지를 먼저 올리고, `latest`에서 설치 자산 참조를 검증한 뒤 `latest.yml`(+`.sig`)과 `update-policy.json`을 마지막에 게시하고 공개 URL에서 서명까지 재검증한다.
|
||||
- Windows installer와 `latest.yml`은 필수다. macOS 산출물이 없는 Windows-only release를 의도했다면 그 판단을 release record에 남긴다.
|
||||
- `package-windows`는 external public-trust code-signing PFX를 protected file variable `WIN_CSC_PFX_FILE`로, 암호와 exact certificate subject를 protected `WIN_CSC_KEY_PASSWORD`, `WIN_CSC_EXPECTED_SIGNER_SUBJECT`로 받아야 한다. GitHub Release도 `WIN_CSC_LINK`, `WIN_CSC_KEY_PASSWORD`, `WIN_CSC_EXPECTED_SIGNER_SUBJECT`가 모두 없으면 실패한다.
|
||||
- `scripts/ci/verify-windows-release-artifact.ps1`는 installer와 unpacked app의 Authenticode `Valid`, exact signer subject, non-self-signed code-signing EKU, PE version, `latest.yml` path/size/SHA-512를 검증한다. 로컬 self-signed `Everything2EverythingDev`는 production 신뢰 인증서가 아니며 gate에서 명시적으로 거부한다.
|
||||
|
|
@ -174,21 +198,11 @@ node --env-file-if-exists=.env scripts/ci/set-forgejo-secrets.mjs --write
|
|||
10. Forgejo Release note/asset, `latest.yml`, `update-policy.json`, installer hash를 외부 public URL에서 다시 검증한다.
|
||||
11. 이전 설치본에서 자동 업데이트 E2E를 실행하고 실행 중 버전·프로세스·사용자 데이터 보존, 그리고 **업데이트 후 로컬 받아쓰기 1회 성공**을 확인한다.
|
||||
|
||||
## 자동 업데이트 게시 (런타임 분리 전제)
|
||||
## 설치본 크기와 네이티브 ABI
|
||||
|
||||
설치본은 **90MiB대**를 유지해야 한다. 로컬 AI 런타임(사이드카 엔진/ffmpeg)을 설치본에 넣으면
|
||||
Cloudflare 업로드 한도(100MiB)를 넘어 `latest.yml`을 게시할 수 없다.
|
||||
Cloudflare 업로드 한도(100MiB)를 넘어 게시할 수 없다 — `build-desktop-installer.mjs` 가 넘으면 실패한다.
|
||||
|
||||
```bash
|
||||
npm run build --workspace=@d3ro/desktop # 렌더러/메인 번들
|
||||
npm run release:portable:build # 런타임 번들 생성(엔진/ffmpeg)
|
||||
npm run release:portable # portable + runtime 채널 게시
|
||||
npm run release:updater:check # 업데이터 게시 예정 확인
|
||||
npm run release:updater -- --ack-unsigned # (인증서 없을 때만) 무서명 게시
|
||||
```
|
||||
|
||||
- 서명 인증서가 있으면 `--ack-unsigned` 없이 게시한다(권장). 무서명 게시는 명시적 예외이며
|
||||
스크립트가 플래그 없이는 즉시 실패한다(GAP-REL-06에 기록).
|
||||
- **네이티브 ABI 게이트 필수**: 패키징 후 `node scripts/ci/verify-native-abi.mjs`로 확인한다.
|
||||
개발 PC에서 `npm install`을 돌리면 `better-sqlite3`가 Node ABI로 재빌드되어 설치본이
|
||||
시작조차 못 한다(실측: 1.3.2). 로컬에서 실행 중인 Electron이 모듈을 잠그면
|
||||
|
|
@ -262,8 +276,10 @@ Desktop release를 게시해도 Android production 출시가 자동으로 완료
|
|||
- `scripts/ci/create-release-tag.mjs` — 릴리스 태그 게이트 (annotated/서명, 불변)
|
||||
- `scripts/ci/verify-release-metadata.mjs` — release metadata 자가 검증
|
||||
- `scripts/ci/verify-windows-release-artifact.ps1` — Windows version·updater metadata·Authenticode gate
|
||||
- `scripts/ci/publish-gitlab-release.mjs` — legacy GitLab registry·Release mirror publisher
|
||||
- `apps/desktop/src/main/update-feed.ts` — runtime updater URL SSOT (canonical Forgejo + legacy mirror 상수)
|
||||
- `scripts/ci/release-desktop.mjs` — 한 줄 릴리스 명령 (`npm run release`)
|
||||
- `scripts/ci/build-desktop-installer.mjs` — 설치본 빌드 (로컬·CI 공용)
|
||||
- `scripts/ci/lib/update-manifest-signature.mjs` · `apps/desktop/src/main/update-signature.ts` — latest.yml Ed25519 서명·검증
|
||||
- `apps/desktop/src/main/update-feed.ts` — runtime updater URL SSOT
|
||||
- `release/update-policy.json` — 채널·최소 지원 버전·강제 업데이트·full/delta·staged rollout·킬 스위치 SSOT
|
||||
- `apps/desktop/src/main/update-policy.ts` — 정책 파싱·결정 순수 로직
|
||||
- `scripts/ci/publish-forgejo-release.mjs` — canonical Forgejo registry·Release·feed publisher
|
||||
|
|
|
|||
|
|
@ -45,11 +45,12 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
|||
| GAP-UX-06 | Desktop | main 쪽 정리 필요: `STTManager.ts:53-129` 공급자 설명 한국어 하드코딩·마케팅 문구("100% 완전 오프라인", "Industry Benchmark") — 렌더러는 더 이상 쓰지 않는다 / audio TEST_DEVICE 가 deviceId 무시 / 사전 `incrementUsage` 호출처 없음(사용 횟수 항상 0) / 사전 발음 필드가 인식 힌트·치환에 쓰이지 않음 / 대화 세션 다시 듣기 IPC 없음 / preload `instruction.getAll` 이 `unknown[]` / 지식 추가 실패 판정이 문구 비교. | 각 파일 | `[ ]` 2026-09-28 (도구·설정 개편 에이전트 보고) |
|
||||
| GAP-UX-07 | Desktop | 2026-09-28 개편 문구는 ko·en 만 — 다른 8개 로케일은 en 폴백. 온보딩 Ollama 모델 크기 표기(`onboarding.llmModelSize` 9.6GB)와 안내 모달의 크기가 다르다. | `packages/i18n/src/locales/*` | `[ ]` 2026-09-28 |
|
||||
| GAP-TEAM-02 | Team | 브라우저에서 초대를 수락하는 경로가 없다. 웹 `accept-invite` 페이지는 발급 링크가 가리키지 않고 로그인 후 토큰을 읽는 곳이 없어 끊겨 있었으므로 삭제했다(사이트 `/accept-invite/`는 앱 딥링크만). | `site/public/accept-invite/`, `server/supabase/functions/team-accept` | `[ ]` 2026-09-26: 데스크톱 전용 사용자를 위한 웹 수락 흐름이 필요하면 `/app` 아래에 다시 설계. |
|
||||
| GAP-REL-10 | Release | `release-windows`(태그 파이프라인)는 서명 가드에 도달하기 **전에** sidecar 단계에서 죽는다. 이 러너 컨텍스트에서는 `sidecar:setup`이 Python 3.11+를 찾지 못한다(`Python 3.11+ 를 찾을 수 없습니다`) → `sidecar:build` → `verify-sidecar-bundle.mjs` 연쇄 실패(실측: run#65 `v1.3.7`, run#61 `v1.3.6`). 같은 러너의 portable 잡은 `py -3.11 → Python 3.11.9`를 찾아 사이드카 빌드에 성공하므로, 워크플로/컨테이너 간 PATH 차이다. | `.forgejo/workflows/release.yml`, `apps/desktop/scripts/setup-sidecar.mjs` | `[!]` 2026-09-19: 러너에 Python 3.11+(`py` 런처 포함)를 보장하거나 워크플로에 `actions/setup-python` 단계를 추가한다. 그 전까지 서명 게시는 불가능하다(GAP-REL-02와 별개 선행 차단). |
|
||||
| GAP-REL-10 | Release | `release-windows`(태그 파이프라인)는 서명 가드에 도달하기 **전에** sidecar 단계에서 죽는다. 이 러너 컨텍스트에서는 `sidecar:setup`이 Python 3.11+를 찾지 못한다(`Python 3.11+ 를 찾을 수 없습니다`) → `sidecar:build` → `verify-sidecar-bundle.mjs` 연쇄 실패(실측: run#65 `v1.3.7`, run#61 `v1.3.6`). 같은 러너의 portable 잡은 `py -3.11 → Python 3.11.9`를 찾아 사이드카 빌드에 성공하므로, 워크플로/컨테이너 간 PATH 차이다. | `.forgejo/workflows/release.yml`, `apps/desktop/scripts/setup-sidecar.mjs` | `[!]` 2026-09-19: 러너에 Python 3.11+(`py` 런처 포함)를 보장하거나 워크플로에 `actions/setup-python` 단계를 추가한다. 그 전까지 서명 게시는 불가능하다(GAP-REL-02와 별개 선행 차단). **2026-10-17 `[x]`**: 런타임이 설치본에서 분리돼 `release.yml` 은 더 이상 사이드카를 빌드하지 않는다(`build-desktop-installer.mjs`). |
|
||||
| GAP-REL-11 | Release | portable 워크플로의 마지막 `actions/upload-artifact@v4` 단계가 Forgejo 러너에서 `GHESNotSupportedError`로 실패한다(증거 보존만 실패, 게시는 성공). | `.forgejo/workflows/portable.yml` | `[x]` 2026-09-19: `v1.3.7` portable 게시는 run#64에서 성공(7z 단일 볼륨 83.7MB + zip 2부, `portable-latest/portable.json`이 1.3.7 보고). 남은 조치: upload-artifact 단계를 제거하거나 v3/다른 보존 방식으로 바꿔 워크플로를 GREEN으로 만든다. |
|
||||
| GAP-REL-12 | Release | Forgejo generic registry는 파일 단위 덮어쓰기를 거부(HTTP 409)하는데, portable 게시 스크립트의 "동일 파일 건너뛰기"가 1MiB 초과 파일을 **크기만** 비교했다. 그래서 새 runtime의 sidecar 볼륨 `.001`이 이전 볼륨과 정확히 같은 94,371,840 bytes였고, 내용이 다른데도 "동일"로 오판해 `runtime-latest`가 낡은 `.001` + 새 `.002`로 갈라졌다(다운로드 시 손상). | `scripts/ci/publish-portable-release.mjs` | `[x]` 2026-09-23: 파일 목록 API(`GET /api/v1/packages/{owner}/generic/{name}/{version}/files`)의 sha256으로 정확히 비교하고, 내용이 다른 파일이 하나라도 있으면 해당 별칭 버전 전체를 삭제 후 재업로드하도록 수정했다. 이미 발생한 `runtime-latest`는 버전을 지우고 재게시해 4개 파일 모두 로컬 해시와 일치함을 확인했다. |
|
||||
| GAP-REL-02 | Release | Windows stable publication needs an external public-trust Authenticode PFX, its password, the exact signer subject, and a Forgejo token, none of which live in the repository. | `.forgejo/workflows/release.yml`, `.gitlab-ci.yml`, `scripts/ci/set-forgejo-secrets.mjs`, `scripts/ci/verify-windows-release-artifact.ps1` | `[!]` 2026-09-18 measured: the Forgejo repo had **zero** Actions secrets; `FORGEJO_TOKEN` is registered now (2026-09-18) but `WIN_CSC_*` still have no values, so `v1.2.0` (run 49) and `v1.3.0` (run 51) both failed at the signing guard and **no updater-feed release has been published since `1.1.0`**. Inject the four secrets (`WIN_CSC_LINK`, `WIN_CSC_KEY_PASSWORD`, `WIN_CSC_EXPECTED_SIGNER_SUBJECT`, `FORGEJO_TOKEN`) with `npm run release:secrets` (check: `npm run release:secrets:check`), then re-run `release.yml` for the `v1.3.0` tag via `workflow_dispatch` (tags are immutable). **2026-09-19 정정**: CI 서명 게이트는 여전히 막혀 있지만, updater feed에는 `1.3.2`~`1.3.7`이 로컬 `release:updater` 경로로 게시되어 있다(GAP-REL-06). **2026-09-23 정정**: `1.4.0`은 게시되지 않았고(GAP-REL-06), `1.5.0`도 로컬 무서명 경로로 게시했다. CI 서명 게이트는 여전히 `WIN_CSC_*` 부재로 막혀 있다(GAP-REL-10의 Python 선행 문제와 별개). |
|
||||
| GAP-REL-06 | Release | 서명 인증서가 없어 stable(`latest`) 채널에 **무서명** 설치본을 게시했다. electron-updater는 `app-update.yml`에 `publisherName`이 없으면 서명 검증을 건너뛰므로 설치는 동작하지만, SmartScreen 평판은 버전마다 0부터 시작한다. | `scripts/ci/publish-updater-release.mjs`, `release/update-policy.json`, `.forgejo/workflows/release.yml` | `[!]` 2026-09-18: `1.3.2`를 `--ack-unsigned`(명시적 승인 플래그)로 게시. **2026-09-19: `1.3.7`도 같은 경로로 게시**(`npm run release:updater -- --ack-unsigned`, 설치본 90.6MiB, `latest.yml`=1.3.7, 설치본 sha512가 피드 메타데이터와 일치). 인증서 확보 시 더 높은 버전으로 서명 게시하여 대체하고, 이 예외를 제거한다. **2026-09-23: `1.5.0`도 같은 경로로 게시**(`npm run release:updater -- --build --ack-unsigned`, 설치본 91.2MiB, `latest.yml`=1.5.0, sha512 검증). |
|
||||
| GAP-REL-02 | Release | Windows stable publication needs an external public-trust Authenticode PFX, its password, the exact signer subject, and a Forgejo token, none of which live in the repository. | `.forgejo/workflows/release.yml`, `.gitlab-ci.yml`, `scripts/ci/set-forgejo-secrets.mjs`, `scripts/ci/verify-windows-release-artifact.ps1` | `[!]` 2026-09-18 measured: the Forgejo repo had **zero** Actions secrets; `FORGEJO_TOKEN` is registered now (2026-09-18) but `WIN_CSC_*` still have no values, so `v1.2.0` (run 49) and `v1.3.0` (run 51) both failed at the signing guard and **no updater-feed release has been published since `1.1.0`**. Inject the four secrets (`WIN_CSC_LINK`, `WIN_CSC_KEY_PASSWORD`, `WIN_CSC_EXPECTED_SIGNER_SUBJECT`, `FORGEJO_TOKEN`) with `npm run release:secrets` (check: `npm run release:secrets:check`), then re-run `release.yml` for the `v1.3.0` tag via `workflow_dispatch` (tags are immutable). **2026-09-19 정정**: CI 서명 게이트는 여전히 막혀 있지만, updater feed에는 `1.3.2`~`1.3.7`이 로컬 `release:updater` 경로로 게시되어 있다(GAP-REL-06). **2026-09-23 정정**: `1.4.0`은 게시되지 않았고(GAP-REL-06), `1.5.0`도 로컬 무서명 경로로 게시했다. CI 서명 게이트는 여전히 `WIN_CSC_*` 부재로 막혀 있다(GAP-REL-10의 Python 선행 문제와 별개). **2026-10-17 `[~]`**: Authenticode 는 더 이상 게시 차단 조건이 아니다 — 무서명 설치본은 Ed25519 서명 `latest.yml` 로 보호하고(GAP-REL-13), `release.yml` 은 `WIN_CSC_*` 가 있으면 서명만 추가한다. 남은 것은 SmartScreen 평판용 인증서(한국 개인은 Azure Artifact Signing 불가, 사업자 필요). |
|
||||
| GAP-REL-13 | Release | **9-27 v1.9.0 이후 3주간 업데이트 0건(커밋 83개 미배포).** 앱 업데이터는 정상(4시간마다 확인, 피드 200)이었지만 게시가 손으로 5~6단계라 아무도 돌리지 않으면 안 나갔고, CI 경로는 서명 가드로 늘 실패했다. 게시 스크립트도 4벌(forgejo·updater·portable·gitlab)로 겹쳐 있었다. | `scripts/ci/release-desktop.mjs`, `scripts/ci/build-desktop-installer.mjs`, `scripts/ci/publish-forgejo-release.mjs`, `scripts/ci/lib/update-manifest-signature.mjs`, `apps/desktop/src/main/update-signature.ts`, `apps/desktop/src/main/services/update-adapters.ts`, `.forgejo/workflows/release.yml` | `[~]` 2026-10-17: `npm run release -- patch|minor` 한 줄(점검→버전→게이트→커밋·태그→빌드→서명·게시→공개 URL 재검증→푸시, `--resume`). latest.yml Ed25519 서명 + 앱이 NsisUpdater `verifySignature` 단계에서 불변 `<version>/latest.yml`+`.sig` 로 설치본 sha512 검증(fail-closed). electron-updater 6.8.9→6.8.10(차분 다운로드 수정). `publish-updater-release.mjs`·`publish-gitlab-release.mjs`·`LEGACY_UPDATE_FEED_URL` 삭제. CI 는 같은 스크립트를 쓰는 예비 경로(피드에 있으면 건너뜀). 검증: 업데이트 테스트 95/95, release:metadata 음성 16, typecheck 0, 게시 --check 자산 4개, 서명 왕복. **남은 것**: 첫 실제 릴리스(1.10.0) 게시 + 1.9.0 설치본→1.10.0 자동 업데이트 E2E, Forgejo 시크릿 `D3RO_UPDATE_SIGNING_KEY` 동기화(`npm run release:secrets`). |
|
||||
| GAP-REL-06 | Release | 서명 인증서가 없어 stable(`latest`) 채널에 **무서명** 설치본을 게시했다. electron-updater는 `app-update.yml`에 `publisherName`이 없으면 서명 검증을 건너뛰므로 설치는 동작하지만, SmartScreen 평판은 버전마다 0부터 시작한다. | `scripts/ci/publish-forgejo-release.mjs`, `release/update-policy.json`, `.forgejo/workflows/release.yml` | `[~]` 2026-10-17: 무서명 게시가 정식 경로가 됐다 — `--ack-unsigned` 예외 대신 latest.yml Ed25519 서명 + 앱 검증(GAP-REL-13). SmartScreen 평판 문제만 남음. 이력: 2026-09-18: `1.3.2`를 `--ack-unsigned`(명시적 승인 플래그)로 게시. **2026-09-19: `1.3.7`도 같은 경로로 게시**(`npm run release:updater -- --ack-unsigned`, 설치본 90.6MiB, `latest.yml`=1.3.7, 설치본 sha512가 피드 메타데이터와 일치). 인증서 확보 시 더 높은 버전으로 서명 게시하여 대체하고, 이 예외를 제거한다. **2026-09-23: `1.5.0`도 같은 경로로 게시**(`npm run release:updater -- --build --ack-unsigned`, 설치본 91.2MiB, `latest.yml`=1.5.0, sha512 검증). |
|
||||
| GAP-REL-07 | Release | 패키징된 `better-sqlite3`가 호스트 Node ABI여서 `1.3.2` 설치본이 시작 즉시 죽었다(NODE_MODULE_VERSION 131 vs 130). 원인: 로컬 `npm install`이 네이티브 모듈을 Node용으로 재빌드했고 패키징이 재빌드를 건너었다. | `scripts/ci/verify-native-abi.mjs`, `scripts/ci/fix-native-abi.mjs`, `.gitlab-ci.yml`/`.forgejo`/`.github` 패키징 단계 | `[x]` 2026-09-18: 패키징 후 Electron ABI를 검증하고, 검증된 트리에서만 설치본을 생성(`--prepackaged`)한다. `1.3.3`은 설치본에서 추출한 바이너리로 재검증 GREEN. |
|
||||
| GAP-ADS-01 | Ads | 9 of 10 desktop ad adapters still extend `UnavailableAdAdapter` (`provider_not_integrated`). | `apps/desktop/src/main/services/ads/*` | `[~]` 2026-09-13: `DirectHouseSponsorAdapter` is now a real configurable REST adapter (bid/impression/click/reward via `endpointUrl`; fail-closed when unconfigured; 22 unit tests GREEN). Remaining 9 need official SDKs/authenticated endpoints. |
|
||||
| GAP-ADS-02 | Ads | Desktop mediation reward accounting is not wired to license quota (`claimReward` still returns no tokens). | `AdMediationEngine.ts`, `AppLayout.tsx` | Wire verified `reportRewardCompletion` to `LicenseService` quota after the direct sponsor endpoint exists. |
|
||||
|
|
@ -76,7 +77,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
|||
| GAP-STT-04 | Local STT | Live partial transcript (`CAP-03`, `voice:partialTranscript`) was marked done but had **no producer**: the channel, popup UI, and preload existed, nothing ever emitted. | `apps/desktop/src/main/services/VoiceModeService.ts`, `LocalSTTService.transcribePartial`, `STTManager.transcribePartial` | `[x]` 2026-09-18: 1.5 s cadence over a 7.5 s trailing window, greedy decode, drained before the final transcription; never inserted. |
|
||||
| GAP-STT-05 | Local STT | The bundled sidecar lacked faster-whisper's Silero VAD data, so `vad_filter=true` transcription would have failed at runtime even with the engine bundled. | `apps/desktop/scripts/build-sidecar.mjs`, `scripts/ci/verify-sidecar-bundle.mjs` | `[x]` 2026-09-18: `--collect-all faster_whisper` plus a packaging-time presence check for `assets/silero_vad_v6.onnx`. |
|
||||
| GAP-REL-03 | Release | 서명이 없어 설치할 수 있는 경로가 없다(인증서 발급 전 공백). | `.forgejo/workflows/portable.yml`, `scripts/ci/build-portable.mjs`, `scripts/local/install-d3ro-voice.ps1`, `bucket/d3ro-voice.json` | `[x]` 2026-09-18: 서명 없는 portable 채널 구현 — 95MiB 7z 분할 볼륨(688MB → 162MiB) + Scoop 버킷 + 수동 설치 스크립트를 Forgejo에 게시. 실제 설치 스크립트 end-to-end 검증(볼륨 다운로드 → SHA-256 → 결합 → 해제 → 엔진 포함 확인). updater feed는 건드리지 않음. **2026-09-19: `1.3.7`이 CI portable run#64에서 `portable-latest`에 게시됨**(7z 단일 볼륨 83.7MB + zip 2부, `portable.json`=1.3.7) — 즉 portable 경로는 CI만으로 동작하고, 실패한 것은 마지막 증거 업로드 단계다(GAP-REL-11). |
|
||||
| GAP-REL-04 | Release | canonical feed는 Cloudflare 뒤에 있어 업로드 본문이 **100MiB**를 넘으면 HTTP 413으로 거부한다. | `scripts/ci/publish-updater-release.mjs`, `docs/deployment/unsigned-distribution.md` | `[~]` 2026-09-18: 설치본을 90.6MiB로 줄여 업데이트 피드 게시를 복구했다(GAP-STT-07). 휴대용/Scoop 채널은 여전히 95MiB 분할이 필요하다. |
|
||||
| GAP-REL-04 | Release | canonical feed는 Cloudflare 뒤에 있어 업로드 본문이 **100MiB**를 넘으면 HTTP 413으로 거부한다. | `scripts/ci/build-desktop-installer.mjs`, `docs/deployment/unsigned-distribution.md` | `[~]` 2026-09-18: 설치본을 90.6MiB로 줄여 업데이트 피드 게시를 복구했다(GAP-STT-07). 휴대용/Scoop 채널은 여전히 95MiB 분할이 필요하다. |
|
||||
| GAP-STT-07 | Local STT | 진(사이드카)을 앱 번들에 넣으면 설치본이 100MiB를 넘고 매 업데이트마다 162MiB를 다시 받는다. | `apps/desktop/src/main/services/RuntimeProvisioner.ts`, `apps/desktop/electron-builder.yml` | `[x]` 2026-09-18: 설치본에서 엔진/ffmpeg를 제거하고 처음 필요할 때 `runtime-latest`에서 내려받는다(부품별 + 결합본 SHA-256 검증). 설치본 189MB → 90.6MiB, 런타임 1회 116MiB(엔진 94.4 + ffmpeg 21.7). 실제 feed로 통합 검증 완료. |
|
||||
| GAP-STT-06 | Local STT | Decode settings were untuned: previous-text conditioning let repeated hallucinations compound, and no VAD parameters meant slow, uneven segments. | `apps/desktop/sidecar/main.py` | `[x]` 2026-09-18: `condition_on_previous_text=false`, bounded low-temperature fallback, `no_speech`/`compression_ratio`/`log_prob` thresholds, 300 ms silence trimming. Same transcript, ~5x faster on the reference machine (7.7 s audio: 1609 ms → 303 ms). |
|
||||
| GAP-KEY-01 | Key bindings | 키바인딩 전면 개편(CAP-16)이 실앱 구동으로 검증되지 않은 상태였다. uiohook 전역 후킹, 더블프레스 타이밍, 마우스 버튼 수신을 실행 중인 Electron 에서 확인한 적이 없었고, 증거가 계약 수준(`packages/core` 117개 통과, 키바인딩 파일 타입 에러 0건)뿐이었다. 에이전트는 데스크톱 GUI 를 띄울 수 없다(`AGENTS.md` §3). | `apps/desktop/src/main/services/KeyBindingService.ts`, `packages/core/__tests__/keybinding.test.ts`, `%APPDATA%/d3ro-voice/logs/main.log`, `%APPDATA%/d3ro-voice/d3ro-voice-config.json` | `[x]` 2026-09-21: 사용자가 Windows 에서 앱을 띄워 검증 완료. 로그(12:53–13:06)에 `Migrated 4 legacy shortcut(s) to keyBindings` → `Loaded 6 key binding(s) from config for 6 action(s)` → `uiohook started, global keyboard/mouse hook active` → `key-bindings initialized` → `Key binding events connected` 가 순서대로 남았고 부팅 에러 0건, STT 모델 로딩까지 정상. 키보드·마우스(MB4/MB5) 바인딩을 UI 로 실제 조작해 동작을 확인했고, 같은 세션의 `Loaded 7 key binding(s) … for 6 action(s)` 가 다중 바인딩이 실동작함을 보인다. 설정 파일 되읽기로 마이그레이션 결과를 확인 — 사용자 커스텀 값이 그대로 보존됐고(dictation `code:49,alt` / hands-free `code:49,alt+shift` / command `code:165,ctrl` / caption `code:49,ctrl+alt+shift`, 팝업 2종은 신규 기본값), 구 `*Shortcut` 4개와 `displayLabel` 은 모두 사라졌다. **남은 것**: `KeyBindingService` 자체의 유닛 테스트는 여전히 없다(실행 검증이 유닛 테스트를 대체하지 않는다). macOS/Linux 는 GAP-KEY-02 로 계속 열려 있다. |
|
||||
|
|
@ -104,6 +105,7 @@ Legend: `[ ]` open · `[~]` in progress · `[!]` blocked externally · `[x]` res
|
|||
| GAP-INPUT-06 | Input intelligence | `[~]` **제안 폭주 상한 및 runtime 확인.** 이전 24.7 s / 4.9 s, boot warmup, `keep_alive: 30m`, 48/96/128 tokens 및 2/5 candidates 기록은 역사적 가설/완화 이력이며 현재 정책이 아니다. 현 정책은 600 ms debounce, 5 s minimum interval, 6 requests/min default (hard max 12), 3 candidates, 64 output tokens, 12-character growth, 8 s timeout, `keep_alive: 2m` 및 boot warmup 제거다. | `apps/desktop/src/main/services/SuggestionService.ts`, `packages/core/src/input-intelligence.ts`, `LocalLLMService.ts` | 표적 자동 검증은 6 files / 69 passed / 0 failed이며 raw Ollama의 15.044 s cold timeout cleanup, 약 119.9 s residency expiry, 그리고 19:48:59 +09:00에 새 generate/unload/kill/retry 없이 확인한 `/api/ps` HTTP 200 / 45.8 ms / `{models:[]}` (`/api/version` HTTP 200 / 7.3 ms / `0.32.13`)도 확인됐다. 전체 strict typecheck는 green이 아니며, 이 raw API unload 증거는 앱 재시작·GUI·실제 자동제안 타이핑 검증이 아니다. 그 경로에서 rate limit, 8 s abort, 3-candidate/64-token 상한을 확인한다. |
|
||||
| GAP-INPUT-08 | Input intelligence | `[~]` **오타 자동 교정(INPUT-19)·문맥 제안(INPUT-20) 실앱 확인 (2026-10-03).** 자동 테스트와 실제 `gemma4:e4b` 프롬프트 프로브는 통과했지만, 외부 앱에서 "백스페이스 N + 붙여넣기" 교체가 정확히 동작하는지는 GUI 로 확인하지 않았다. | `apps/desktop/src/main/services/{TypoCorrectionService,SuggestionService,PersonalGraphService,TextInsertService}.ts`, `packages/core/src/{typo-correction,writing-context,personal-graph}.ts` | `run-desktop.bat` 재시작 후 메모장·카톡·크롬 입력창에서: (1) `됬어요 ` 치고 멈추면 `됐어요 ` 로 바뀌는지, (2) 한글 문장 중 `dkssudgktpdy` 가 `안녕하세요` 로 바뀌는지, (3) 교체 도중 계속 치면 교체가 취소되고 글이 섞이지 않는지, (4) 고친 단어를 원래대로 되돌리면 다시 고치지 않는지, (5) 앱마다 백스페이스 한 번이 한 글자를 지우는지(리치 에디터·웹 에디터), (6) 교정 뒤 제안이 고친 문장 기준으로 뜨는지. 문제가 있는 앱은 제외 목록 또는 앱별 차단 규칙으로 다룬다. |
|
||||
| GAP-INPUT-09 | Input intelligence | `[~]` **prefill 이어 쓰기·문서/대화 문맥(INPUT-21) 실앱 확인 (2026-10-03).** 실제 `gemma4:e4b` 프로브 15개 시나리오와 단위 테스트는 통과했지만, (a) 외부 앱 UIA 가 커서 앞 문서 전체를 주는지(케어렛 미상 앱은 tail 폴백), (b) 채팅 앱이 보내기 뒤 입력칸을 실제로 비우는 스냅샷을 내는지(카톡은 UIA 텍스트 길이 0 인 경우가 있었다 — GAP-INPUT-01), (c) 단어 중간 수락(`attach`)이 실제 삽입에서 공백 없이 붙는지는 GUI 로 확인하지 않았다. 후보 다양성: 마저 쓰기 모드는 prefill 분포가 뾰족해 채우기 후보가 1~2개에서 멈출 때가 많다. | `apps/desktop/src/main/services/{SuggestionService,InputTelemetryService,LocalLLMService,llm-prompts}.ts`, `packages/core/src/{chat-template,recent-writes,suggestion-text,writing-context}.ts`, `apps/desktop/tests/integration/suggestion-quality.ollama.test.ts` | `run-desktop.bat` 재시작 후: (1) 긴 메모장 문서 끝에서 앞부분의 날짜·이름을 이어 받는지, (2) 슬랙/디스코드 같은 Chromium 채팅에서 메시지를 보낸 뒤 다음 메시지 제안이 앞 메시지를 이어 받는지(로그 `제안 판단 입력` + 프롬프트 길이), (3) `내일 3시에 회의실` 같은 단어 중간에서 수락하면 `회의실에서…` 로 붙는지, (4) 지어낸 사실로 후보를 버린 로그(`제안 후보 버림 (unsupported-facts…)`)가 과하게 잦지 않은지. 모델 교체 시 `D3RO_SUGGESTION_PROBE=1 D3RO_SUGGESTION_PROBE_MODEL=<태그>` 로 같은 프로브를 다시 돌린다. **2026-10-03 19:00 "제안 창이 잘 안 뜸" 로그 분석**: 보류 1위 WindowsTerminal(Claude Code) `caret-unknown` 721회 — 입력 상자 아래 상태줄 때문에 화면 전체 기준으로 매번 "문서 중간 편집" 판정 → `SuggestionService._terminalContext` 가 입력 줄 연속성(늘거나 줄면 커서=끝)으로 판단. 2위 Chrome `not-typing` 122회 — 타이핑 중 UIA 포커스가 입력칸↔legacy 요소를 오가며 기준선을 다시 잡음 → 같은 창·클릭 없이 치는 중의 깜빡임이면 편집한 칸 유지(`input-telemetry-focus-flicker.test.ts`). 모든 앱에서 caret 오프셋을 못 얻는 것(caret=-1)과 Kitedesk/Candy/Paca 의 legacy(읽기 불가)는 별도 과제. 19:10 재시작 뒤 6분간 첫 후보 10회 생성(터미널 caret-unknown 721→4). **수락 키 전달 문제**: uiohook 은 키를 엿듣기만 해서 Ctrl+Alt+Enter 가 Claude Code 에도 전달돼 개행이 들어갔다 → 제안 창이 떠 있는 동안만 제안 단축키를 globalShortcut(noop)으로 잡아 OS 가 삼키게 하고 창이 사라지면 해제(`KeyBindingService.setSuggestionCaptureActive`, `suggestionCaptureAccelerators`). 실앱에서 수락 시 개행이 더는 안 들어가는지, 창이 없을 때 다른 앱의 Ctrl+Alt+Enter/↑↓ 가 정상인지 확인 필요. |
|
||||
| GAP-INPUT-10 | Input intelligence | `[~]` **제안 창 오타 교정·반응성(INPUT-22) 실앱 확인 (2026-10-17).** 단위 테스트·실모델 프로브·팝업 렌더 스크린샷은 통과, HEAD 로컬 빌드를 띄워 둠(설치본 v1.9.0 종료). 실제 앱에서 교정 수락(백스페이스 N + 붙여넣기)과 조합 중 Space 확정이 정확히 동작하는지는 미확인. 사용자 입력에 섞여 들어간 홀로 남은 `ㅇ`(이력 DB 접두에 반복)의 출처 — 사용자가 친 것인지, 조합이 깨진 흔적인지 — 미확정. | `apps/desktop/src/main/services/{SuggestionService,TypoCorrectionService,TextInsertService,InputTelemetryService}.ts`, `apps/desktop/src/renderer/popups/suggestion-overlay/*`, `packages/core/src/typo-correction.ts` | 에이전트 창·카톡·크롬에서: (1) `안ㄴ뇽하세여.?` 치고 멈추면 `오타 고침` 줄과 함께 후보가 뜨는지, 수락하면 오타가 지워지고 `안녕하세요.? …` 로 바뀌는지, (2) 마지막 글자가 조합 중일 때 수락해도 글자가 남거나 더 지워지지 않는지, (3) 수락 → Space → 멈춤에서 다음 제안이 바로 뜨는지(`rate-limited` 로그 없어야 함), (4) 후보 12개가 다 차도 창이 저절로 닫히지 않는지(45초 TTL 전), (5) 낱자 없는 오타는 첫 후보 뒤 교정 줄이 늦게 붙는지. |
|
||||
|
||||
| GAP-SYNC-01 | Sync | Desktop↔mobile sync was one-way and lossy. (1) `pushAll` set the cursor to *now* before `pullAll` ran, so the first pull after sign-in fetched nothing — mobile-created data never reached the desktop except via Realtime while running (which never connected, GAP-SYNC-02). (2) `_inArray` used only the first meeting id, so memos/documents of every other meeting were never pushed. (3) No deletion propagation either way. (4) Pull had no `user_id` filter — team meetings of other users landed in the personal DB and a desktop re-push cleared `team_id`. (5) One global, local-clock cursor across accounts; no pagination (1,000-row cap). (6) Desktop writes did not move `history.revision`, so mobile's optimistic concurrency silently overwrote desktop edits. (7) One case-duplicate dictionary word failed the whole batch. (8) Memo tags, custom commands, templates, favorites and history titles were not synced at all; anonymous local-mode data was never uploaded after sign-in. | `apps/desktop/src/main/services/sync/*`, `CloudSyncService.ts`, `server/supabase/migrations/20260927000034_cross_device_sync_parity.sql` | `[x]` 2026-09-27: engine rewritten (outbox + per-user server-clock keyset cursors + tombstones + per-row isolation + dictionary adoption + natural-key memo tags + client-keyed template RPCs + local-mode import). Evidence: `apps/desktop/tests/main/sync/SyncEngine.test.ts` (20) + `apps/desktop/tests/integration/cross-device-sync.supabase.test.ts` (5, local Supabase stack); full desktop suite 1499/1500 (1 = known caption env timeout); SQL checks for revision bump, tombstones, account-delete cascade. |
|
||||
| GAP-SYNC-02 | Sync | **Desktop Realtime never connected.** Electron 33 main (Node 20.18) has no global `WebSocket`; supabase-js Realtime only ever logged `TIMED_OUT`/`CLOSED` (installed-app log 2026-09-16) and gave up after three retries. Also: filtered `postgres_changes` channels never deliver DELETE (Supabase limitation). | `CloudSyncService.ts`, `services/sync/realtime-transport.ts`, integration test "Realtime" case | `[x]` 2026-09-27: `ws` injected as the Realtime transport (`ws` now a declared desktop dependency, externalised in the main bundle); deletions arrive as `sync_tombstones` INSERT events; the heartbeat re-subscribes a channel that is not `joined`. Verified live against the local stack (INSERT/UPDATE + tombstone events received). |
|
||||
|
|
|
|||
8
package-lock.json
generated
8
package-lock.json
generated
|
|
@ -127,7 +127,7 @@
|
|||
"drizzle-orm": "^0.45.2",
|
||||
"electron-log": "^5.2.0",
|
||||
"electron-store": "^10.0.0",
|
||||
"electron-updater": "^6.3.9",
|
||||
"electron-updater": "^6.8.10",
|
||||
"koffi": "^3.3.1",
|
||||
"lucide-react": "^1.25.0",
|
||||
"overlayscrollbars": "^2.16.0",
|
||||
|
|
@ -8553,9 +8553,9 @@
|
|||
"license": "ISC"
|
||||
},
|
||||
"node_modules/electron-updater": {
|
||||
"version": "6.8.9",
|
||||
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.8.9.tgz",
|
||||
"integrity": "sha512-ZhVxM9iGONUpZGI1FxdMRgJjUFXi7AYGVa5PwKlO1tV1/4zDxQmfKpXOHVztKrd6L9rLcFjERvi1Mf2vxyTkig==",
|
||||
"version": "6.8.10",
|
||||
"resolved": "https://registry.npmjs.org/electron-updater/-/electron-updater-6.8.10.tgz",
|
||||
"integrity": "sha512-6ZSwTUoBNtI1f9Pp8y6zCigD8LKV18Rb1+1A7sZzvKvA17o2sqSqKmm0t6uvKeF+HZqA4vsmw4qq0JSS241USQ==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"builder-util-runtime": "9.7.0",
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
"version:sync": "node scripts/ci/sync-version.mjs --write",
|
||||
"contract:check": "node scripts/ci/sync-core-contract.mjs --check",
|
||||
"contract:sync": "node scripts/ci/sync-core-contract.mjs --write",
|
||||
"release": "node --env-file-if-exists=.env scripts/ci/release-desktop.mjs",
|
||||
"release:build": "node scripts/ci/build-desktop-installer.mjs",
|
||||
"release:metadata": "node scripts/ci/verify-release-metadata.mjs",
|
||||
"release:metadata:test": "node scripts/ci/verify-release-metadata.mjs --self-test",
|
||||
"release:forgejo": "node scripts/ci/publish-forgejo-release.mjs",
|
||||
|
|
@ -54,9 +56,7 @@
|
|||
"typecheck:mobile": "npm --prefix apps/mobile-rn run typecheck",
|
||||
"lint:mobile": "npm --prefix apps/mobile-rn run lint",
|
||||
"test:mobile": "npm --prefix apps/mobile-rn test",
|
||||
"verify:all": "npm run typecheck && npm run typecheck:mobile && npm run lint && npm run lint:mobile && npm run test && npm run test:mobile && npm run check:design",
|
||||
"release:updater": "node --env-file-if-exists=.env scripts/ci/publish-updater-release.mjs",
|
||||
"release:updater:check": "node scripts/ci/publish-updater-release.mjs --check"
|
||||
"verify:all": "npm run typecheck && npm run typecheck:mobile && npm run lint && npm run lint:mobile && npm run test && npm run test:mobile && npm run check:design"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
||||
|
|
|
|||
73
scripts/ci/build-desktop-installer.mjs
Normal file
73
scripts/ci/build-desktop-installer.mjs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
// scripts/ci/build-desktop-installer.mjs
|
||||
// 데스크톱 NSIS 설치본(+ blockmap + latest.yml)을 apps/desktop/release/<version>/ 에 만든다.
|
||||
// 로컬 릴리스(release-desktop.mjs)와 CI(release.yml)가 같은 빌드를 쓴다.
|
||||
//
|
||||
// 순서: electron-vite 빌드 → unpacked 트리 → 네이티브 ABI 보정·검증 → app-update.yml 보장
|
||||
// → --prepackaged 로 설치본 (재빌드 없이 검증된 트리 그대로 포장)
|
||||
//
|
||||
// 로컬 AI 런타임(사이드카/ffmpeg)은 설치본에 넣지 않는다 — Cloudflare 업로드 한도(100MiB) 때문.
|
||||
// 앱이 처음 필요할 때 runtime-latest 에서 받는다(RuntimeProvisioner, `npm run release:portable`).
|
||||
//
|
||||
// WIN_CSC_LINK 가 있으면 electron-builder 가 Authenticode 서명을 한다. 없으면 무서명 — 그 대신
|
||||
// 게시 단계가 latest.yml 을 Ed25519 로 서명하고 앱이 검증한다(update-manifest-signature.mjs).
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
const desktopDir = join(root, 'apps', 'desktop')
|
||||
/** Cloudflare 업로드 본문 한도 (실측: 110MiB → 413) */
|
||||
const MAX_UPLOAD_BYTES = 100 * 1024 * 1024
|
||||
|
||||
const version = JSON.parse(readFileSync(join(root, 'release', 'product-version.json'), 'utf8')).version
|
||||
const releaseDir = join(desktopDir, 'release', version)
|
||||
const appDir = join(releaseDir, 'win-unpacked')
|
||||
const builderFlags = ['--config', 'electron-builder.yml', '--publish', 'never', '-c.win.forceCodeSigning=false', '-c.npmRebuild=false']
|
||||
|
||||
// 같은 버전을 다시 빌드할 때 이전 산출물(휴대용 zip 등)이 섞여 게시되지 않게 비운다.
|
||||
rmSync(releaseDir, { recursive: true, force: true })
|
||||
|
||||
run('npm', ['run', 'build', '--workspace=@d3ro/desktop'], root)
|
||||
run('npx', ['electron-builder', '--win', 'dir', '--x64', ...builderFlags], desktopDir)
|
||||
runNode('scripts/ci/fix-native-abi.mjs', ['--dir', appDir])
|
||||
runNode('scripts/ci/verify-native-abi.mjs', ['--dir', appDir])
|
||||
// app-update.yml 이 없으면 설치된 앱의 electron-updater 가 설정을 못 읽어 자동 업데이트가 죽는다.
|
||||
runNode('scripts/ci/write-app-update-yml.mjs', ['--dir', appDir])
|
||||
run('npx', ['electron-builder', '--prepackaged', appDir, '--win', 'nsis', '--x64', ...builderFlags], desktopDir)
|
||||
|
||||
const installer = readdirSync(releaseDir).find((name) => /-Setup-.*\.exe$/.test(name))
|
||||
if (!installer) fail(`설치본이 없습니다: ${releaseDir}`)
|
||||
for (const required of [`${installer}.blockmap`, 'latest.yml']) {
|
||||
if (!existsSync(join(releaseDir, required))) fail(`${required} 가 없습니다: ${releaseDir}`)
|
||||
}
|
||||
if (!existsSync(join(appDir, 'resources', 'app-update.yml'))) fail('app-update.yml 누락')
|
||||
if (!readFileSync(join(releaseDir, 'latest.yml'), 'utf8').includes(`version: ${version}`)) {
|
||||
fail('latest.yml 의 버전이 product-version.json 과 다릅니다.')
|
||||
}
|
||||
const size = statSync(join(releaseDir, installer)).size
|
||||
if (size > MAX_UPLOAD_BYTES) {
|
||||
fail(
|
||||
`설치본 ${(size / 1048576).toFixed(1)}MiB 가 업로드 한도 100MiB 를 넘습니다 — ` +
|
||||
'런타임(사이드카/ffmpeg)을 electron-builder.yml 의 extraResources/files 에 다시 넣지 않았는지 확인하세요.',
|
||||
)
|
||||
}
|
||||
process.stdout.write(`[build] ${installer} (${(size / 1048576).toFixed(1)}MiB) 준비 완료 — ${releaseDir}\n`)
|
||||
|
||||
function run(command, args, cwd) {
|
||||
process.stdout.write(`[build] $ ${command} ${args.join(' ')}\n`)
|
||||
const result = spawnSync(command, args, { cwd, stdio: 'inherit', shell: process.platform === 'win32' })
|
||||
if (result.status !== 0) fail(`${command} ${args[0]} 실패 (exit ${result.status ?? 'null'})`)
|
||||
}
|
||||
|
||||
function runNode(relativePath, args) {
|
||||
process.stdout.write(`[build] $ node ${relativePath} ${args.join(' ')}\n`)
|
||||
const result = spawnSync(process.execPath, [join(root, relativePath), ...args], { cwd: root, stdio: 'inherit' })
|
||||
if (result.status !== 0) fail(`${relativePath} 실패 (exit ${result.status ?? 'null'})`)
|
||||
}
|
||||
|
||||
function fail(message) {
|
||||
process.stderr.write(`[build] ${message}\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
46
scripts/ci/create-update-signing-key.mjs
Normal file
46
scripts/ci/create-update-signing-key.mjs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
// scripts/ci/create-update-signing-key.mjs
|
||||
// 업데이트 메타데이터 서명용 Ed25519 키를 한 번 만든다.
|
||||
// - 비밀키 → 루트 .env 의 D3RO_UPDATE_SIGNING_KEY (이미 있으면 중단 — 키를 바꾸면 기존 앱이 새 릴리스를 거부한다)
|
||||
// - 공개키 → release/desktop-update-public.pem
|
||||
// 그 다음 공개키를 apps/desktop/src/main/update-signature.ts 의 UPDATE_SIGNING_PUBLIC_KEY 에 넣고,
|
||||
// `npm run release:secrets` 로 Forgejo 시크릿에 동기화한다.
|
||||
//
|
||||
// 키를 잃어버리면 이 공개키를 내장한 설치본은 새 릴리스를 더는 받지 못한다(수동 재설치 필요).
|
||||
// .env 백업이 유일한 복구 수단이다.
|
||||
|
||||
import { generateKeyPairSync } from 'node:crypto'
|
||||
import { appendFileSync, existsSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { SIGNING_KEY_ENV, signManifest, verifyManifest } from './lib/update-manifest-signature.mjs'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
const envPath = join(root, '.env')
|
||||
const publicPath = join(root, 'release', 'desktop-update-public.pem')
|
||||
|
||||
const envText = existsSync(envPath) ? readFileSync(envPath, 'utf8') : ''
|
||||
if (new RegExp(`^${SIGNING_KEY_ENV}=`, 'm').test(envText)) {
|
||||
process.stderr.write(`[update-key] .env 에 ${SIGNING_KEY_ENV} 가 이미 있습니다 — 덮어쓰지 않습니다.\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
if (existsSync(publicPath)) {
|
||||
process.stderr.write(`[update-key] ${publicPath} 가 이미 있습니다 — 덮어쓰지 않습니다.\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const { privateKey, publicKey } = generateKeyPairSync('ed25519')
|
||||
const publicPem = publicKey.export({ type: 'spki', format: 'pem' }).toString()
|
||||
const probe = 'version: 0.0.0\n'
|
||||
if (!verifyManifest(probe, signManifest(probe, privateKey), publicPem)) {
|
||||
process.stderr.write('[update-key] 생성한 키 자체 검사 실패\n')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const privateB64 = privateKey.export({ type: 'pkcs8', format: 'der' }).toString('base64')
|
||||
const separator = envText && !envText.endsWith('\n') ? '\n' : ''
|
||||
appendFileSync(
|
||||
envPath,
|
||||
`${separator}\n# 데스크톱 업데이트 메타데이터 서명 키 (Ed25519, 잃어버리면 기존 앱이 새 릴리스를 거부)\n${SIGNING_KEY_ENV}=${privateB64}\n`,
|
||||
)
|
||||
writeFileSync(publicPath, publicPem, { flag: 'wx' })
|
||||
process.stdout.write(`[update-key] 비밀키 → .env ${SIGNING_KEY_ENV}\n[update-key] 공개키 → ${publicPath}\n${publicPem}`)
|
||||
44
scripts/ci/lib/update-manifest-signature.mjs
Normal file
44
scripts/ci/lib/update-manifest-signature.mjs
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
// scripts/ci/lib/update-manifest-signature.mjs
|
||||
// 업데이트 메타데이터(latest.yml) Ed25519 서명 — 게시 스크립트와 사후 검증이 같이 쓴다.
|
||||
//
|
||||
// 설치본에 Authenticode 서명이 없으면 electron-updater 는 서명 검증을 건너뛴다. 그래서 피드가
|
||||
// 털리면 아무 설치 파일이나 배포될 수 있다. 대신 latest.yml 을 오프라인 키로 서명하고, 앱은 내장
|
||||
// 공개키로 서명을 확인한 뒤 받은 설치 파일의 sha512 를 그 latest.yml 과 대조한다
|
||||
// (apps/desktop/src/main/update-signature.ts).
|
||||
//
|
||||
// 비밀키: 환경변수 D3RO_UPDATE_SIGNING_KEY = PKCS8 DER 의 base64 한 줄 (.env 정본, Forgejo 시크릿 동기화).
|
||||
// 공개키: release/desktop-update-public.pem (앱 내장 사본과 verify-release-metadata 가 대조).
|
||||
|
||||
import { createPrivateKey, createPublicKey, sign, verify } from 'node:crypto'
|
||||
|
||||
export const SIGNING_KEY_ENV = 'D3RO_UPDATE_SIGNING_KEY'
|
||||
export const SIGNATURE_SUFFIX = '.sig'
|
||||
|
||||
export function loadSigningKey(env = process.env) {
|
||||
const raw = env[SIGNING_KEY_ENV]?.trim()
|
||||
if (!raw) {
|
||||
throw new Error(
|
||||
`${SIGNING_KEY_ENV} 가 없습니다 — 업데이트 메타데이터를 서명할 수 없습니다. ` +
|
||||
'루트 .env 에 있는지 확인하세요 (처음이면 node scripts/ci/create-update-signing-key.mjs).',
|
||||
)
|
||||
}
|
||||
const key = createPrivateKey({ key: Buffer.from(raw, 'base64'), format: 'der', type: 'pkcs8' })
|
||||
if (key.asymmetricKeyType !== 'ed25519') throw new Error(`${SIGNING_KEY_ENV} 는 Ed25519 키여야 합니다.`)
|
||||
return key
|
||||
}
|
||||
|
||||
/** latest.yml 바이트에 대한 서명(base64 한 줄) */
|
||||
export function signManifest(manifest, privateKey) {
|
||||
return `${sign(null, Buffer.from(manifest), privateKey).toString('base64')}\n`
|
||||
}
|
||||
|
||||
export function verifyManifest(manifest, signatureText, publicKeyPem) {
|
||||
const signature = Buffer.from(String(signatureText).trim(), 'base64')
|
||||
if (signature.length !== 64) return false
|
||||
return verify(null, Buffer.from(manifest), createPublicKey(publicKeyPem), signature)
|
||||
}
|
||||
|
||||
/** 비밀키에서 공개키 PEM — 게시 전에 저장소 공개키와 짝이 맞는지 확인할 때 쓴다 */
|
||||
export function publicPemOf(privateKey) {
|
||||
return createPublicKey(privateKey).export({ type: 'spki', format: 'pem' }).toString()
|
||||
}
|
||||
|
|
@ -7,6 +7,10 @@
|
|||
// - latest 경로: /api/packages/<owner>/generic/d3ro-voice/latest/<file> (electron-updater feed)
|
||||
// 2) release/update-policy.json을 latest feed에 게시 (원격 정책/킬 스위치)
|
||||
// 3) Forgejo Release 생성/갱신 + 설치 자산 첨부 (admin·site 다운로드 허브)
|
||||
// 4) 공개 URL 에서 서명된 latest.yml 을 다시 받아 서명·설치본 해시를 검증 (기존 앱이 받을 그대로)
|
||||
//
|
||||
// latest.yml 은 Ed25519 로 서명해 latest.yml.sig 를 함께 올린다 (D3RO_UPDATE_SIGNING_KEY 필수).
|
||||
// 무서명 설치본이라도 앱이 이 서명으로 설치 파일을 검증한다 — apps/desktop/src/main/update-signature.ts.
|
||||
//
|
||||
// 배포 순서 보장: 설치파일/blockmap을 먼저 올리고 update metadata(latest.yml)를
|
||||
// 마지막에 게시한다. 기존 설치본이 배포 도중 404를 받지 않는다.
|
||||
|
|
@ -19,7 +23,7 @@
|
|||
|
||||
import { createHash } from "node:crypto";
|
||||
import { createReadStream, readFileSync } from "node:fs";
|
||||
import { readFile, readdir, stat } from "node:fs/promises";
|
||||
import { readFile, readdir, stat, writeFile } from "node:fs/promises";
|
||||
import { basename, join } from "node:path";
|
||||
import process from "node:process";
|
||||
import { fileURLToPath, URL } from "node:url";
|
||||
|
|
@ -38,6 +42,13 @@ import {
|
|||
parseRuntimeMinVersions,
|
||||
} from "./lib/runtime-feed-gate.mjs";
|
||||
import { assertValidUpdatePolicy } from "./lib/update-policy-schema.mjs";
|
||||
import {
|
||||
SIGNATURE_SUFFIX,
|
||||
loadSigningKey,
|
||||
publicPemOf,
|
||||
signManifest,
|
||||
verifyManifest,
|
||||
} from "./lib/update-manifest-signature.mjs";
|
||||
|
||||
const { forgejoAuthorization } = credentialHelpers;
|
||||
|
||||
|
|
@ -81,7 +92,25 @@ assertValidUpdatePolicy(readFileSync(policyPath), "release/update-policy.json");
|
|||
const releaseDirectory = process.env.FORGEJO_RELEASE_DIR?.trim()
|
||||
? process.env.FORGEJO_RELEASE_DIR.trim()
|
||||
: fileURLToPath(new URL(`../../apps/desktop/release/${version}/`, import.meta.url));
|
||||
const ASSET_PATTERN = /(\.exe|\.dmg|\.zip|\.blockmap|^(latest|beta|alpha)(-mac|-linux)?\.yml)$/;
|
||||
// 같은 폴더에 휴대용 zip/7z·__uninstaller exe 가 섞일 수 있다 — 업데이트 자산만 고른다.
|
||||
const ASSET_PATTERN = /(-Setup-[^/]*\.exe(\.blockmap)?|\.dmg|-mac\.zip(\.blockmap)?|^(latest|beta|alpha)(-mac|-linux)?\.yml(\.sig)?)$/;
|
||||
|
||||
// latest.yml 서명 — 키가 저장소 공개키와 짝이 아니면 앱이 거부할 릴리스이므로 아무것도 올리지 않는다.
|
||||
const repoPublicKeyPem = readFileSync(
|
||||
fileURLToPath(new URL("../../release/desktop-update-public.pem", import.meta.url)),
|
||||
"utf8",
|
||||
);
|
||||
if (!dryRun || process.env.D3RO_UPDATE_SIGNING_KEY) {
|
||||
const signingKey = loadSigningKey();
|
||||
if (publicPemOf(signingKey).trim() !== repoPublicKeyPem.trim()) {
|
||||
throw new Error("D3RO_UPDATE_SIGNING_KEY 가 release/desktop-update-public.pem 과 짝이 아닙니다.");
|
||||
}
|
||||
for (const name of await readdir(releaseDirectory)) {
|
||||
if (!/^(latest|beta|alpha)(-mac|-linux)?\.yml$/.test(name)) continue;
|
||||
const manifest = await readFile(join(releaseDirectory, name));
|
||||
await writeFile(join(releaseDirectory, `${name}${SIGNATURE_SUFFIX}`), signManifest(manifest, signingKey));
|
||||
}
|
||||
}
|
||||
|
||||
const files = [];
|
||||
for (const name of await readdir(releaseDirectory)) {
|
||||
|
|
@ -96,6 +125,9 @@ if (!files.some((file) => file.name.endsWith(".exe"))) {
|
|||
if (!files.some((file) => file.name === "latest.yml")) {
|
||||
throw new Error(`latest.yml is missing for ${tag} — check electron-builder.yml publish config.`);
|
||||
}
|
||||
if (!dryRun && !files.some((file) => file.name === `latest.yml${SIGNATURE_SUFFIX}`)) {
|
||||
throw new Error(`latest.yml${SIGNATURE_SUFFIX} is missing for ${tag}.`);
|
||||
}
|
||||
if (!files.some((file) => file.name.endsWith(".dmg"))) {
|
||||
process.stdout.write(`WARNING: macOS artifacts missing for ${tag} — Windows-only release.\n`);
|
||||
}
|
||||
|
|
@ -195,7 +227,10 @@ if (latestFeed.update) {
|
|||
await verifyPublicFile(`${packageVersionedUrl}/latest.yml`);
|
||||
}
|
||||
|
||||
// 4) Forgejo Release 생성/갱신 + 자산 첨부
|
||||
// 4) 기존 앱이 받을 그대로 검증 — 공개(무인증) 버전별 경로의 latest.yml + 서명 + 설치본 해시
|
||||
await verifySignedPublicManifest();
|
||||
|
||||
// 5) Forgejo Release 생성/갱신 + 자산 첨부
|
||||
const description = await buildReleaseDescription();
|
||||
const releaseId = await upsertRelease(description);
|
||||
for (const file of sorted) {
|
||||
|
|
@ -236,7 +271,7 @@ function safeAssetName(name) {
|
|||
}
|
||||
|
||||
function isUpdateMetadata(name) {
|
||||
return /(?:\.blockmap$|^(?:latest|beta|alpha)(?:-mac|-linux)?\.yml$|^update-policy\.json$)/.test(name);
|
||||
return /(?:\.blockmap$|^(?:latest|beta|alpha)(?:-mac|-linux)?\.yml(?:\.sig)?$|^update-policy\.json$)/.test(name);
|
||||
}
|
||||
|
||||
function isYamlUpdateMetadata(name) {
|
||||
|
|
@ -333,6 +368,31 @@ async function verifyPublicFile(url) {
|
|||
if (!body.trim()) throw new Error(`Public updater file is empty: ${url}`);
|
||||
}
|
||||
|
||||
async function verifySignedPublicManifest() {
|
||||
const url = `${packageVersionedUrl}/latest.yml`;
|
||||
const [manifestResponse, signatureResponse] = await Promise.all([
|
||||
fetch(url, { cache: "no-store" }),
|
||||
fetch(`${url}${SIGNATURE_SUFFIX}`, { cache: "no-store" }),
|
||||
]);
|
||||
if (!manifestResponse.ok || !signatureResponse.ok) {
|
||||
throw new Error(
|
||||
`Public signed manifest unreachable: latest.yml HTTP ${manifestResponse.status}, .sig HTTP ${signatureResponse.status}`,
|
||||
);
|
||||
}
|
||||
const manifest = await manifestResponse.text();
|
||||
if (!verifyManifest(manifest, await signatureResponse.text(), repoPublicKeyPem)) {
|
||||
throw new Error(`Public ${url} signature does not verify with release/desktop-update-public.pem.`);
|
||||
}
|
||||
const signedSha512 = manifest.match(/^sha512:\s*(\S+)\s*$/m)?.[1];
|
||||
const installer = sorted.find((file) => /-Setup-.*\.exe$/.test(file.name));
|
||||
const localSha512 = createHash("sha512").update(await readFile(installer.path)).digest("base64");
|
||||
if (signedSha512 !== localSha512) {
|
||||
throw new Error(`Signed latest.yml sha512 does not match ${installer.name}.`);
|
||||
}
|
||||
process.stdout.write(` verified public signed manifest ${url}
|
||||
`);
|
||||
}
|
||||
|
||||
async function buildReleaseDescription() {
|
||||
const changelog = await readFile(
|
||||
fileURLToPath(new URL("../../CHANGELOG.md", import.meta.url)),
|
||||
|
|
|
|||
283
scripts/ci/release-desktop.mjs
Normal file
283
scripts/ci/release-desktop.mjs
Normal file
|
|
@ -0,0 +1,283 @@
|
|||
// scripts/ci/release-desktop.mjs
|
||||
// 데스크톱 릴리스 한 줄 명령 — 버전 올리기부터 기존 사용자 자동 업데이트까지.
|
||||
//
|
||||
// npm run release -- patch # 1.9.0 → 1.9.1 (fix)
|
||||
// npm run release -- minor # 1.9.0 → 1.10.0 (feat)
|
||||
// npm run release -- 2.0.0 # 직접 지정
|
||||
// npm run release -- minor --dry-run # 무엇을 할지만 출력
|
||||
// npm run release -- --resume # 빌드/게시/푸시 중 실패했을 때 같은 버전으로 이어서
|
||||
//
|
||||
// 단계 (실패하면 거기서 멈추고, --resume 으로 이어 간다):
|
||||
// 1. 점검 main 브랜치 · 깨끗한 작업 트리 · Forgejo 토큰 · 서명 키 짝 · 태그 미사용
|
||||
// 2. 버전 product-version.json + sync-version --write + CHANGELOG 섹션(없으면 커밋 제목으로 초안)
|
||||
// 3. 게이트 typecheck · version:check · release:metadata
|
||||
// 4. 커밋 + annotated 태그 (로컬만 — 게시가 끝나야 푸시한다)
|
||||
// 5. 빌드 build-desktop-installer.mjs
|
||||
// 6. 게시 publish-forgejo-release.mjs (latest.yml Ed25519 서명 · 불변 버전 경로 · latest 피드 · 공개 URL 재검증)
|
||||
// 7. 푸시 chanpaca main + 태그 (origin 미러는 실패해도 경고만)
|
||||
//
|
||||
// 태그는 불변이다. 게시된 버전에 문제가 있으면 더 높은 patch 로 다시 낸다.
|
||||
|
||||
import { spawnSync } from 'node:child_process'
|
||||
import { existsSync, readFileSync, writeFileSync } from 'node:fs'
|
||||
import { dirname, join } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
import { loadSigningKey, publicPemOf } from './lib/update-manifest-signature.mjs'
|
||||
|
||||
const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
||||
const args = process.argv.slice(2)
|
||||
const dryRun = args.includes('--dry-run')
|
||||
const resume = args.includes('--resume')
|
||||
const bumpArg = args.find((arg) => !arg.startsWith('--'))
|
||||
const CANONICAL_REMOTE = 'chanpaca'
|
||||
const MIRROR_REMOTES = ['origin']
|
||||
const FEED = 'https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice'
|
||||
|
||||
const versionPath = join(root, 'release', 'product-version.json')
|
||||
const changelogPath = join(root, 'CHANGELOG.md')
|
||||
|
||||
if (!resume && !bumpArg) {
|
||||
fail('사용법: npm run release -- <patch|minor|major|X.Y.Z> [--dry-run] 또는 npm run release -- --resume')
|
||||
}
|
||||
|
||||
// ── 1. 점검 ──
|
||||
step('점검')
|
||||
const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'])
|
||||
if (branch !== 'main') fail(`main 브랜치에서만 릴리스합니다 (현재 ${branch}).`)
|
||||
if (!process.env.FORGEJO_TOKEN && !(process.env.FORGEJO_USERNAME && process.env.FORGEJO_PASSWORD)) {
|
||||
fail('FORGEJO_TOKEN 이 없습니다 — 루트 .env 를 확인하세요.')
|
||||
}
|
||||
const repoPublicKey = readFileSync(join(root, 'release', 'desktop-update-public.pem'), 'utf8')
|
||||
if (publicPemOf(loadSigningKey()).trim() !== repoPublicKey.trim()) {
|
||||
fail('D3RO_UPDATE_SIGNING_KEY 가 release/desktop-update-public.pem 과 짝이 아닙니다.')
|
||||
}
|
||||
const dirty = git(['status', '--porcelain'])
|
||||
if (dirty && !dryRun) fail(`작업 트리가 깨끗하지 않습니다 — 먼저 커밋하세요:\n${dirty}`)
|
||||
|
||||
const current = readJson(versionPath)
|
||||
let version = current.version
|
||||
|
||||
if (resume) {
|
||||
const tag = `v${version}`
|
||||
if (!git(['tag', '--list', tag])) fail(`${tag} 태그가 없습니다 — 이어 갈 릴리스가 없습니다.`)
|
||||
if (git(['rev-parse', `${tag}^{commit}`]) !== git(['rev-parse', 'HEAD'])) {
|
||||
fail(`HEAD 가 ${tag} 가 아닙니다 — 태그 이후 커밋이 있으면 새 버전으로 릴리스하세요.`)
|
||||
}
|
||||
info(`${tag} 이어서 진행 (빌드 → 게시 → 푸시)`)
|
||||
} else {
|
||||
version = nextVersion(current.version, bumpArg)
|
||||
const tag = `v${version}`
|
||||
if (git(['tag', '--list', tag])) fail(`${tag} 태그가 이미 있습니다. 실패한 릴리스를 이어 가려면 --resume.`)
|
||||
if (spawnGit(['ls-remote', '--exit-code', '--tags', CANONICAL_REMOTE, tag]).status === 0) {
|
||||
fail(`${CANONICAL_REMOTE} 에 ${tag} 가 이미 있습니다.`)
|
||||
}
|
||||
if (await feedHasVersion(version)) fail(`피드에 ${version} 가 이미 게시돼 있습니다.`)
|
||||
|
||||
// ── 2. 버전 ──
|
||||
step(`버전 ${current.version} → ${version}`)
|
||||
const changelog = readFileSync(changelogPath, 'utf8')
|
||||
const releaseDate = todayKst()
|
||||
const notes = changelog.includes(`## [${version}] - `) ? null : draftNotes(current.version)
|
||||
if (dryRun) {
|
||||
info(notes ? `CHANGELOG 초안:\n${notes}` : 'CHANGELOG 섹션 있음')
|
||||
info('단계: 커밋·태그 → 빌드 → 게시(서명) → 공개 URL 검증 → 푸시')
|
||||
info('dry-run — 아무것도 바꾸지 않았습니다.')
|
||||
process.exit(0)
|
||||
}
|
||||
writeFileSync(
|
||||
versionPath,
|
||||
`${JSON.stringify({ ...current, version, ...mobileBuildNumbers(version), releaseDate }, null, 2)}\n`,
|
||||
)
|
||||
if (notes) {
|
||||
insertChangelogSection(version, releaseDate, notes)
|
||||
} else {
|
||||
// 손으로 쓴 섹션의 날짜만 오늘로 맞춘다.
|
||||
writeFileSync(
|
||||
changelogPath,
|
||||
changelog.replace(new RegExp(`## \\[${escapeRegExp(version)}\\] - \\d{4}-\\d{2}-\\d{2}`), `## [${version}] - ${releaseDate}`),
|
||||
)
|
||||
}
|
||||
ensurePlayChangelogs(mobileBuildNumbers(version).androidVersionCode)
|
||||
runNode('scripts/ci/sync-version.mjs', ['--write'])
|
||||
|
||||
// ── 3. 게이트 ──
|
||||
step('게이트')
|
||||
runNpm(['run', 'version:check'])
|
||||
runNpm(['run', 'release:metadata'])
|
||||
runNpm(['run', 'typecheck'])
|
||||
// 여기까지 실패하면 버전 파일만 바뀐 상태다 — git checkout -- . 로 되돌리고 다시 실행.
|
||||
|
||||
// ── 4. 커밋 + 태그 ──
|
||||
step(`커밋 + 태그 ${tag}`)
|
||||
gitInherit(['add', '-u'])
|
||||
gitInherit(['commit', '-m', `chore(release): ${tag}`])
|
||||
runNode('scripts/ci/create-release-tag.mjs', [])
|
||||
}
|
||||
|
||||
const tag = `v${version}`
|
||||
|
||||
// 태그가 생긴 뒤의 실패는 --resume 으로 이어 간다.
|
||||
const resumeHint = '\n고친 뒤 이어 가기: npm run release -- --resume'
|
||||
|
||||
// 이미 게시가 끝난 버전을 다시 빌드하면 바이트가 달라 불변 경로와 충돌한다 — 푸시만 남은 경우다.
|
||||
if (resume && (await feedHasVersion(version))) {
|
||||
info(`피드에 ${version} 가 이미 있습니다 — 빌드·게시를 건너뜁니다.`)
|
||||
} else {
|
||||
// ── 5. 빌드 ──
|
||||
step('빌드')
|
||||
runNode('scripts/ci/build-desktop-installer.mjs', [], {}, resumeHint)
|
||||
|
||||
// ── 6. 게시 ──
|
||||
step('게시')
|
||||
runNode('scripts/ci/publish-forgejo-release.mjs', [], { FORGEJO_RELEASE_TAG: tag }, resumeHint)
|
||||
}
|
||||
|
||||
// ── 7. 푸시 ──
|
||||
step('푸시')
|
||||
// 게시는 끝났다 — 푸시 실패는 사용자 업데이트에 영향이 없고, 손으로 다시 밀면 된다.
|
||||
const pushed = spawnSync('git', ['push', CANONICAL_REMOTE, 'main', tag], { cwd: root, stdio: 'inherit' })
|
||||
if (pushed.status !== 0) warn(`${CANONICAL_REMOTE} 푸시 실패 — git push ${CANONICAL_REMOTE} main ${tag}`)
|
||||
for (const remote of MIRROR_REMOTES) {
|
||||
const result = spawnSync('git', ['push', remote, 'main', tag], { cwd: root, stdio: 'inherit' })
|
||||
if (result.status !== 0) warn(`${remote} 미러 푸시 실패 — 나중에 git push ${remote} main ${tag}`)
|
||||
}
|
||||
|
||||
step('완료')
|
||||
info(`${tag} 게시 완료. 기존 설치본은 다음 업데이트 확인(시작 15초 뒤, 이후 4시간마다)에 받습니다.`)
|
||||
info(`피드: ${FEED}/latest/latest.yml`)
|
||||
|
||||
// ── helpers ──
|
||||
|
||||
function nextVersion(from, bump) {
|
||||
const [major, minor, patch] = from.split('.').map(Number)
|
||||
if (bump === 'patch') return `${major}.${minor}.${patch + 1}`
|
||||
if (bump === 'minor') return `${major}.${minor + 1}.0`
|
||||
if (bump === 'major') return `${major + 1}.0.0`
|
||||
if (/^\d+\.\d+\.\d+$/.test(bump)) {
|
||||
const [a, b, c] = bump.split('.').map(Number)
|
||||
if (a * 1e8 + b * 1e4 + c <= major * 1e8 + minor * 1e4 + patch) fail(`${bump} 는 ${from} 보다 높아야 합니다.`)
|
||||
return bump
|
||||
}
|
||||
fail(`알 수 없는 버전 지정: ${bump} (patch|minor|major|X.Y.Z)`)
|
||||
}
|
||||
|
||||
/** 1.9.0 → 1090000 (기존 규칙: major*1e6 + minor*1e4 + patch*1e2) */
|
||||
function mobileBuildNumbers(next) {
|
||||
const [major, minor, patch] = next.split('.').map(Number)
|
||||
const code = major * 1_000_000 + minor * 10_000 + patch * 100
|
||||
return { androidVersionCode: code, iosBuildNumber: code }
|
||||
}
|
||||
|
||||
function draftNotes(previous) {
|
||||
const subjects = git(['log', '--no-merges', '--format=%s', `v${previous}..HEAD`]).split('\n').filter(Boolean)
|
||||
const groups = { Added: [], Fixed: [], Changed: [] }
|
||||
for (const subject of subjects) {
|
||||
const match = subject.match(/^(\w+)(?:\([^)]*\))?!?:\s*(.+)$/)
|
||||
const type = match?.[1]
|
||||
const text = match?.[2] ?? subject
|
||||
if (type === 'feat') groups.Added.push(text)
|
||||
else if (type === 'fix') groups.Fixed.push(text)
|
||||
else if (type === 'perf' || type === 'refactor') groups.Changed.push(text)
|
||||
}
|
||||
const body = Object.entries(groups)
|
||||
.filter(([, items]) => items.length > 0)
|
||||
.map(([heading, items]) => `### ${heading}\n${items.map((item) => `- ${item}`).join('\n')}`)
|
||||
.join('\n\n')
|
||||
return body || '### Changed\n- Maintenance release.'
|
||||
}
|
||||
|
||||
function insertChangelogSection(next, date, notes) {
|
||||
const text = readFileSync(changelogPath, 'utf8')
|
||||
const anchor = text.search(/\n## \[\d+\.\d+\.\d+\]/)
|
||||
const section =
|
||||
`\n## [${next}] - ${date}\n\n` +
|
||||
'> Published from an annotated tag. Installer and update metadata are served by the\n' +
|
||||
'> canonical Forgejo feed; no binaries are committed to this repository.\n\n' +
|
||||
`${notes}\n`
|
||||
writeFileSync(changelogPath, anchor === -1 ? `${text.trimEnd()}\n${section}` : `${text.slice(0, anchor)}\n${section}${text.slice(anchor)}`)
|
||||
}
|
||||
|
||||
/**
|
||||
* 모바일과 버전을 같이 쓰므로 release:metadata 가 새 versionCode 의 Play '새 기능' 문구를 요구한다.
|
||||
* 데스크톱만 내는 릴리스면 일반 문구로 채운다 — 모바일을 실제로 낼 때 고쳐 쓴다.
|
||||
*/
|
||||
function ensurePlayChangelogs(versionCode) {
|
||||
const texts = {
|
||||
'ko-KR': '안정성과 성능을 개선했습니다.',
|
||||
'en-US': 'Stability and performance improvements.',
|
||||
}
|
||||
for (const [locale, text] of Object.entries(texts)) {
|
||||
const path = join(root, 'apps', 'mobile-rn', 'metadata', 'android', locale, 'changelogs', `${versionCode}.txt`)
|
||||
if (!existsSync(path)) {
|
||||
writeFileSync(path, `${text}\n`)
|
||||
gitInherit(['add', path])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function feedHasVersion(next) {
|
||||
const response = await fetch(`${FEED}/${next}/latest.yml`, { cache: 'no-store' }).catch(() => null)
|
||||
return Boolean(response?.ok)
|
||||
}
|
||||
|
||||
function todayKst() {
|
||||
return new Date(Date.now() + 9 * 3600_000).toISOString().slice(0, 10)
|
||||
}
|
||||
|
||||
function escapeRegExp(value) {
|
||||
return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
|
||||
}
|
||||
|
||||
function readJson(path) {
|
||||
return JSON.parse(readFileSync(path, 'utf8'))
|
||||
}
|
||||
|
||||
function spawnGit(commandArgs) {
|
||||
return spawnSync('git', commandArgs, { cwd: root, encoding: 'utf8' })
|
||||
}
|
||||
|
||||
function git(commandArgs) {
|
||||
const result = spawnGit(commandArgs)
|
||||
if (result.status !== 0 && !(commandArgs[0] === 'tag' && commandArgs[1] === '--list')) {
|
||||
fail(`git ${commandArgs.join(' ')} 실패: ${result.stderr?.trim() || `exit ${result.status}`}`)
|
||||
}
|
||||
return (result.stdout ?? '').trim()
|
||||
}
|
||||
|
||||
function gitInherit(commandArgs) {
|
||||
const result = spawnSync('git', commandArgs, { cwd: root, stdio: 'inherit' })
|
||||
if (result.status !== 0) fail(`git ${commandArgs.join(' ')} 실패 (exit ${result.status ?? 'null'})`)
|
||||
}
|
||||
|
||||
function runNpm(commandArgs) {
|
||||
info(`$ npm ${commandArgs.join(' ')}`)
|
||||
const result = spawnSync('npm', commandArgs, { cwd: root, stdio: 'inherit', shell: process.platform === 'win32' })
|
||||
if (result.status !== 0) fail(`npm ${commandArgs.join(' ')} 실패 (exit ${result.status ?? 'null'})`)
|
||||
}
|
||||
|
||||
function runNode(relativePath, scriptArgs, env = {}, hint = '') {
|
||||
info(`$ node ${relativePath} ${scriptArgs.join(' ')}`)
|
||||
const result = spawnSync(process.execPath, [join(root, relativePath), ...scriptArgs], {
|
||||
cwd: root,
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env, ...env },
|
||||
})
|
||||
if (result.status !== 0) fail(`${relativePath} 실패 (exit ${result.status ?? 'null'})${hint}`)
|
||||
}
|
||||
|
||||
function step(name) {
|
||||
process.stdout.write(`\n[release] ── ${name} ──\n`)
|
||||
}
|
||||
|
||||
function info(message) {
|
||||
process.stdout.write(`[release] ${message}\n`)
|
||||
}
|
||||
|
||||
function warn(message) {
|
||||
process.stdout.write(`[release] 경고: ${message}\n`)
|
||||
}
|
||||
|
||||
function fail(message) {
|
||||
process.stderr.write(`[release] ${message}\n`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
|
@ -30,7 +30,7 @@ const SECRETS = [
|
|||
{ name: 'FORGEJO_TOKEN', envKey: 'FORGEJO_TOKEN', required: true, usedBy: 'release.yml, portable.yml' },
|
||||
{ name: 'WIN_CSC_LINK', envKey: 'WIN_CSC_LINK', required: false, usedBy: 'release.yml' },
|
||||
{ name: 'WIN_CSC_KEY_PASSWORD', envKey: 'WIN_CSC_KEY_PASSWORD', required: false, usedBy: 'release.yml' },
|
||||
{ name: 'WIN_CSC_EXPECTED_SIGNER_SUBJECT', envKey: 'WIN_CSC_EXPECTED_SIGNER_SUBJECT', required: false, usedBy: 'release.yml' },
|
||||
{ name: 'D3RO_UPDATE_SIGNING_KEY', envKey: 'D3RO_UPDATE_SIGNING_KEY', required: true, usedBy: 'release.yml' },
|
||||
]
|
||||
|
||||
const LOCAL_HOST = /^(https?:\/\/)?(localhost|127\.|0\.0\.0\.0|\[::1\]|host\.docker\.internal)/i
|
||||
|
|
|
|||
46
scripts/ci/setup-nas-cron-runner.sh
Normal file
46
scripts/ci/setup-nas-cron-runner.sh
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
#!/usr/bin/env bash
|
||||
# scripts/ci/setup-nas-cron-runner.sh
|
||||
# NAS 에 d3ro-voice 저장소 전용 Forgejo 러너(라벨 `nas`)를 띄운다.
|
||||
#
|
||||
# 왜: linux-builder 러너는 노트북 한 대뿐이라 노트북이 꺼지면 payple-renew 크론도
|
||||
# 멈춘다(GAP-CI-02). 상시 켜진 NAS 에서 크론을 돌린다. 기존 NAS 러너
|
||||
# (forgejo-runner, 다른 저장소 전용)는 건드리지 않는다.
|
||||
#
|
||||
# 사용 (루트에서): bash scripts/ci/setup-nas-cron-runner.sh
|
||||
# 필요: 루트 .env 의 FORGEJO_TOKEN, ssh 별칭 yunchan-nas.
|
||||
# 되돌리기: ssh yunchan-nas 'docker rm -f d3ro-nas-runner && rm -rf /volume1/docker/d3ro-nas-runner'
|
||||
# 후 Forgejo 저장소 설정 > Actions > Runners 에서 d3ro-nas 삭제.
|
||||
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../.."
|
||||
|
||||
token=$(grep '^FORGEJO_TOKEN=' .env | cut -d= -f2- | tr -d '"')
|
||||
[ -n "$token" ] || { echo "FORGEJO_TOKEN 이 .env 에 없습니다." >&2; exit 1; }
|
||||
|
||||
reg=$(curl -fsS -m 15 -H "Authorization: token $token" \
|
||||
"https://git.chanpaca.net/api/v1/repos/yunchan/d3ro-voice/actions/runners/registration-token" |
|
||||
node -e 'let s="";process.stdin.on("data",d=>s+=d).on("end",()=>process.stdout.write(JSON.parse(s).token))')
|
||||
|
||||
# 등록 토큰은 명령줄에 남기지 않고 stdin 으로 넘긴다.
|
||||
printf '%s\n' "$reg" | ssh -o BatchMode=yes yunchan-nas '
|
||||
export PATH=$PATH:/usr/local/bin
|
||||
set -e
|
||||
read -r RT
|
||||
D=/volume1/docker/d3ro-nas-runner
|
||||
IMG=code.forgejo.org/forgejo/runner:6
|
||||
# 기존 forgejo-runner 와 같이 root 로 돈다. 기본 사용자(1000)는 Synology ACL 에 막혀 .runner 를 못 쓴다.
|
||||
if docker ps -a --format "{{.Names}}" | grep -qx d3ro-nas-runner; then
|
||||
echo "d3ro-nas-runner 가 이미 있습니다."; docker ps --filter name=d3ro-nas-runner; exit 0
|
||||
fi
|
||||
mkdir -p "$D"
|
||||
[ -f "$D/config.yml" ] || grep -v A_TEST_ENV /volume1/docker/forgejo-runner/config.yml > "$D/config.yml"
|
||||
[ -f "$D/.runner" ] || docker run --rm -u 0:0 -v "$D:/data" -w /data "$IMG" forgejo-runner register \
|
||||
--no-interactive --config /data/config.yml --instance http://192.168.0.39:3000 \
|
||||
--token "$RT" --name d3ro-nas --labels "nas:docker://node:22-bookworm"
|
||||
docker run -d --name d3ro-nas-runner --restart unless-stopped -u 0:0 \
|
||||
-v "$D:/data" -v /var/run/docker.sock:/var/run/docker.sock -w /data -e HOME=/data \
|
||||
"$IMG" forgejo-runner daemon --config /data/config.yml >/dev/null
|
||||
sleep 6
|
||||
docker ps --filter name=d3ro-nas-runner --format "{{.Names}} {{.Status}}"
|
||||
docker logs --tail 4 d3ro-nas-runner 2>&1
|
||||
'
|
||||
|
|
@ -7,9 +7,6 @@ const root = join(dirname(fileURLToPath(import.meta.url)), '..', '..')
|
|||
// canonical updater feed: Forgejo Generic Package Registry
|
||||
const CANONICAL_UPDATE_FEED =
|
||||
'https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/latest'
|
||||
// legacy mirror: GitLab Generic Registry (pre-Forgejo installs still poll this)
|
||||
const LEGACY_UPDATE_FEED =
|
||||
'https://gitlab.twentyoz.kr:8443/api/v4/projects/1172/packages/generic/d3ro-voice/latest'
|
||||
|
||||
function read(path) {
|
||||
return readFileSync(join(root, path), 'utf8')
|
||||
|
|
@ -31,7 +28,9 @@ function loadSurfaces(readSurface = read) {
|
|||
updatePolicySource: readSurface('apps/desktop/src/main/update-policy.ts'),
|
||||
updateService: readSurface('apps/desktop/src/main/services/UpdateService.ts'),
|
||||
updateAdapters: readSurface('apps/desktop/src/main/services/update-adapters.ts'),
|
||||
publisher: readSurface('scripts/ci/publish-gitlab-release.mjs'),
|
||||
updateSignature: readSurface('apps/desktop/src/main/update-signature.ts'),
|
||||
updatePublicKey: readSurface('release/desktop-update-public.pem'),
|
||||
releaseCommand: readSurface('scripts/ci/release-desktop.mjs'),
|
||||
forgejoPublisher: readSurface('scripts/ci/publish-forgejo-release.mjs'),
|
||||
gitlab: readSurface('.gitlab-ci.yml'),
|
||||
forgejoRelease: readSurface('.forgejo/workflows/release.yml'),
|
||||
|
|
@ -128,12 +127,35 @@ function validate(surfaces) {
|
|||
|
||||
// ── canonical feed contract: runtime == builder == Forgejo canonical ──
|
||||
const sourceFeed = surfaces.updateFeed.match(/UPDATE_FEED_URL\s*=\s*\n?\s*['"]([^'"]+)['"]/)?.[1]
|
||||
const legacyFeed = surfaces.updateFeed.match(/LEGACY_UPDATE_FEED_URL\s*=\s*\n?\s*['"]([^'"]+)['"]/)?.[1]
|
||||
const builderFeed = surfaces.builder.match(/publish:\s*[\s\S]*?\n\s+url:\s*["']([^"']+)["']/)?.[1]
|
||||
fail(sourceFeed === CANONICAL_UPDATE_FEED, 'desktop_runtime_update_feed_drift')
|
||||
fail(builderFeed === CANONICAL_UPDATE_FEED, 'desktop_builder_update_feed_drift')
|
||||
fail(!/\/releases\/\d+\.\d+\.\d+/.test(sourceFeed ?? ''), 'desktop_update_feed_version_pinned')
|
||||
fail(legacyFeed === LEGACY_UPDATE_FEED, 'desktop_legacy_mirror_feed_missing')
|
||||
fail(!surfaces.updateFeed.includes('gitlab'), 'desktop_legacy_gitlab_feed_reintroduced')
|
||||
|
||||
// ── 업데이트 메타데이터 Ed25519 서명: 앱 내장 공개키 == 저장소 공개키, 앱이 실제로 검증 ──
|
||||
const embeddedKey = surfaces.updateSignature.match(/UPDATE_SIGNING_PUBLIC_KEY = `([^`]+)`/)?.[1]?.trim()
|
||||
let updateKeyValid = false
|
||||
try {
|
||||
updateKeyValid = createPublicKey(surfaces.updatePublicKey).asymmetricKeyType === 'ed25519'
|
||||
} catch {
|
||||
updateKeyValid = false
|
||||
}
|
||||
fail(updateKeyValid, 'update_signing_public_key_invalid')
|
||||
fail(embeddedKey === surfaces.updatePublicKey.trim(), 'update_signing_public_key_drift')
|
||||
fail(surfaces.updateAdapters.includes('verifyDownloadedUpdate('), 'update_signature_verification_missing')
|
||||
fail(
|
||||
surfaces.forgejoPublisher.includes('signManifest(') && surfaces.forgejoPublisher.includes('verifySignedPublicManifest()'),
|
||||
'forgejo_publisher_manifest_signing_missing',
|
||||
)
|
||||
fail(surfaces.forgejoRelease.includes('D3RO_UPDATE_SIGNING_KEY'), 'forgejo_release_signing_key_missing')
|
||||
// 로컬 한 줄 명령과 CI 예비 경로가 같은 빌드·게시 스크립트를 써야 한다
|
||||
fail(
|
||||
surfaces.releaseCommand.includes('build-desktop-installer.mjs') &&
|
||||
surfaces.releaseCommand.includes('publish-forgejo-release.mjs') &&
|
||||
surfaces.forgejoRelease.includes('build-desktop-installer.mjs'),
|
||||
'release_paths_diverged',
|
||||
)
|
||||
|
||||
// ── update policy SSOT ──
|
||||
const policy = surfaces.updatePolicy
|
||||
|
|
@ -183,12 +205,6 @@ function validate(surfaces) {
|
|||
'update_service_differential_control_missing',
|
||||
)
|
||||
|
||||
// ── legacy GitLab publisher (mirror) ──
|
||||
fail(surfaces.publisher.includes('const latestFiles = [...sortedFiles].sort'), 'publisher_asset_first_order_missing')
|
||||
fail(!surfaces.publisher.includes('deletePackagesForVersion("latest")'), 'publisher_deletes_live_feed_first')
|
||||
fail(surfaces.publisher.includes('verifyPublicLatestFile'), 'publisher_public_metadata_verification_missing')
|
||||
fail(surfaces.publisher.includes('release/product-version.json'), 'publisher_product_version_gate_missing')
|
||||
|
||||
// ── canonical Forgejo publisher contract ──
|
||||
fail(!/1\.0\.0/.test(surfaces.forgejoPublisher), 'forgejo_publisher_hardcoded_version')
|
||||
fail(surfaces.forgejoPublisher.includes('release/product-version.json'), 'forgejo_publisher_version_gate_missing')
|
||||
|
|
@ -243,7 +259,6 @@ function validate(surfaces) {
|
|||
androidVersionCode: metadata.androidVersionCode,
|
||||
iosBuildNumber: metadata.iosBuildNumber,
|
||||
updateFeed: sourceFeed,
|
||||
legacyUpdateFeed: legacyFeed,
|
||||
updateChannel: policy.defaultChannel,
|
||||
minimumSupportedVersion: policy.minimumSupportedVersion,
|
||||
electronVersion: lockedElectron,
|
||||
|
|
@ -282,9 +297,16 @@ if (process.argv.includes('--self-test')) {
|
|||
expectRejected(
|
||||
surfaces,
|
||||
(candidate) => {
|
||||
candidate.updateFeed = candidate.updateFeed.replace(LEGACY_UPDATE_FEED, 'https://example.invalid/legacy')
|
||||
candidate.updatePublicKey = candidate.desktopLicensePublicKey
|
||||
},
|
||||
'desktop_legacy_mirror_feed_missing',
|
||||
'update_signing_public_key_drift',
|
||||
)
|
||||
expectRejected(
|
||||
surfaces,
|
||||
(candidate) => {
|
||||
candidate.updateAdapters = candidate.updateAdapters.replaceAll('verifyDownloadedUpdate(', 'skipVerification(')
|
||||
},
|
||||
'update_signature_verification_missing',
|
||||
)
|
||||
expectRejected(
|
||||
surfaces,
|
||||
|
|
@ -345,9 +367,9 @@ if (process.argv.includes('--self-test')) {
|
|||
expectRejected(
|
||||
surfaces,
|
||||
(candidate) => {
|
||||
candidate.publisher = candidate.publisher.replace('const latestFiles = [...sortedFiles].sort', 'const latestFiles = sortedFiles.sort')
|
||||
candidate.forgejoPublisher = candidate.forgejoPublisher.replaceAll('signManifest(', 'noSign(')
|
||||
},
|
||||
'publisher_asset_first_order_missing',
|
||||
'forgejo_publisher_manifest_signing_missing',
|
||||
)
|
||||
expectRejected(
|
||||
surfaces,
|
||||
|
|
@ -385,7 +407,7 @@ if (process.argv.includes('--self-test')) {
|
|||
if (!missingDesktopKeyRejected) {
|
||||
throw new Error('release_metadata_self_test_failed:desktop_license_public_key_missing')
|
||||
}
|
||||
result.negativeCases = 14
|
||||
result.negativeCases = 16
|
||||
}
|
||||
|
||||
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue