d3ro-voice/.forgejo/workflows/portable.yml

125 lines
5.6 KiB
YAML

name: portable-unsigned
# 서명 없는 휴대용 배포 채널.
#
# 배경: NSIS/MSIX 설치본은 public-trust Authenticode 서명이 필수라 인증서가 없는 동안
# 게시할 수 없다(실측: 릴리스 파이프라인 2회 모두 서명 가드에서 실패). 이 워크플로는
# 인증서 없이 동작하는 7z 분할 볼륨 + Scoop 채널을 게시한다.
#
# 안전 규칙:
# - 자동 업데이트 피드(latest.yml / update-policy.json)를 절대 건드리지 않는다.
# - 파일명에 -portable 을 두어 서명된 릴리스 자산과 혼동되지 않게 한다.
# - Cloudflare 업로드 한도(100MiB)를 넘지 않게 95MiB 볼륨으로 나누어 게시한다.
#
# 필요한 시크릿: FORGEJO_TOKEN (write:package)
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
jobs:
portable-windows:
runs-on: windows
defaults: { run: { shell: pwsh } }
steps:
- name: checkout
env: { CI_TOKEN: "${{ github.token }}" }
run: |
$u = [Uri]$env:GITHUB_SERVER_URL
$url = "$($u.Scheme)://actions:$($env:CI_TOKEN)@$($u.Authority)/$($env:GITHUB_REPOSITORY).git"
if (-not (Test-Path .git)) { git init -q . }
if (git remote | Select-String -Quiet '^origin$') { git remote set-url origin $url } else { git remote add origin $url }
git fetch -q --depth 1 origin $env:GITHUB_REF
git checkout -q -f FETCH_HEAD
git clean -qfdx
- name: 버전 정본 대조
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"
$published = 'false'
$base = 'https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice'
function Read-PublishedIndex($url) {
try { return Invoke-RestMethod $url }
catch {
if ($_.Exception.Response.StatusCode.value__ -eq 404) { return $null }
throw
}
}
$portable = Read-PublishedIndex "$base/portable-$releaseVersion/portable.json"
$runtime = Read-PublishedIndex "$base/runtime-$releaseVersion/runtime.json"
if ($portable -or $runtime) {
if ($portable.version -ne $releaseVersion -or $runtime.version -ne $releaseVersion) {
throw 'Partial immutable publication. Resume with preserved local artifacts; do not rebuild.'
}
$portableLatest = Read-PublishedIndex "$base/portable-latest/portable.json"
$runtimeLatest = Read-PublishedIndex "$base/runtime-latest/runtime.json"
if (-not $portableLatest -or -not $runtimeLatest -or
[version]$portableLatest.version -lt [version]$releaseVersion -or
[version]$runtimeLatest.version -lt [version]$releaseVersion) {
throw 'Latest aliases incomplete. Resume the local publisher with preserved artifacts.'
}
$published = 'true'
}
"published=$published" >> $env:GITHUB_OUTPUT
- name: 의존성 설치
if: steps.feed.outputs.published != 'true'
run: npm ci
- name: STT 사이드카 빌드
if: steps.feed.outputs.published != 'true'
run: |
npm run sidecar:setup --workspace=@d3ro/desktop
npm run sidecar:build --workspace=@d3ro/desktop
node scripts/ci/verify-sidecar-bundle.mjs
- name: 데스크톱 번들 빌드
if: steps.feed.outputs.published != 'true'
run: npm run build --workspace=@d3ro/desktop
- name: 데스크톱 렌더러 번들 검증
if: steps.feed.outputs.published != 'true'
run: node scripts/ci/verify-desktop-renderer-bundles.mjs
- name: 휴대용 ZIP + Scoop 매니페스트 생성
if: steps.feed.outputs.published != 'true'
run: node scripts/ci/build-portable.mjs
- name: Forgejo portable 채널 게시
if: steps.feed.outputs.published != 'true'
env:
FORGEJO_TOKEN: "${{ secrets.FORGEJO_TOKEN }}"
run: node scripts/ci/publish-portable-release.mjs
- name: 게시 요약 출력
if: steps.feed.outputs.published != 'true'
# Forgejo Actions 러너는 actions/upload-artifact@v4 의 GHES 스토리지 프로토콜을 지원하지 않으므로(GAP-REL-11),
# 실제 배포 산출물은 앞 단계에서 Forgejo Generic Package Registry 에 이미 게시됐고 여기서는 해시 요약을 남긴다.
run: |
$version = node -p "require('./release/product-version.json').version"
$manifestPath = "apps/desktop/release/$version/portable.json"
if (-not (Test-Path $manifestPath)) {
throw "portable.json 이 없습니다: $manifestPath"
}
$manifest = Get-Content $manifestPath -Raw | ConvertFrom-Json
$summaryLines = @(
"### Portable Release ($($manifest.version))",
"- Volumes: $($manifest.volumeCount)",
"- Total Size: $([math]::Round($manifest.totalSize / 1MB, 1)) MiB",
"- Feed: https://git.chanpaca.net/api/packages/yunchan/generic/d3ro-voice/portable-$($manifest.version)/portable.json"
)
foreach ($vol in $manifest.volumes) {
$summaryLines += " - ``$($vol.name)``: ``$($vol.sha256)``"
}
$summaryText = $summaryLines -join "`n"
Write-Host $summaryText
if ($env:GITHUB_STEP_SUMMARY) {
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $summaryText -Encoding utf8
}