1
0
Fork 0

fix(release): 릴리즈 스크립트의 평문 자격증명 제거 — .env FORGEJO_TOKEN 사용

- curl/REST 인증을 Basic(아이디:비밀번호 리터럴)에서 토큰 헤더로 전환
- 토큰이 없으면 빌드 전에 즉시 중단
- 결과를 쓰지 않던 git credential fill 프로세스 제거
- .env 를 .gitignore 에 추가
- ReleaseScriptSecretsTests: 스크립트에 자격증명이 다시 들어오지 않도록 고정
This commit is contained in:
Yun Chan 2026-10-06 03:03:31 +09:00
parent 8003ff95ca
commit 4c942cf00b
3 changed files with 66 additions and 11 deletions

View file

@ -48,6 +48,13 @@ function Import-EnvFile {
}
Import-EnvFile (Join-Path $RootDir '.env')
# Forgejo 인증은 .gitignore 된 .env 의 FORGEJO_TOKEN 으로만 받는다 (스크립트에 자격증명을 두지 않는다).
# 몇 분짜리 빌드를 돌리기 전에 먼저 확인한다.
if (-not $env:FORGEJO_TOKEN -and -not $DryRun) {
Write-Error "FORGEJO_TOKEN 이 없습니다. 저장소 루트 .env 에 FORGEJO_TOKEN=<액세스 토큰> 을 넣으세요. (Forgejo → 설정 → 애플리케이션 → 액세스 토큰, 권한: write:repository)"
exit 1
}
Write-Host "==========================================================" -ForegroundColor Cyan
Write-Host " Everything2Everything 릴리즈 파이프라인" -ForegroundColor Cyan
Write-Host " 버전: $Version (Tag: $Tag, Manifest: $FourPartVersion)" -ForegroundColor Cyan
@ -217,12 +224,10 @@ if (-not $DryRun) {
# ── Forgejo REST API 릴리즈 등록 ─────────────────────────────────
Write-Host "`n[Gate 5] Forgejo REST API 릴리즈 등록 중..." -ForegroundColor Yellow
# 자격증명 조회
$credProcess = Start-Process git -ArgumentList "credential fill" -NoNewWindow -PassThru -RedirectStandardInput ([IO.Path]::GetTempFileName()) -RedirectStandardOutput ([IO.Path]::GetTempFileName())
# 기본 Windows Credential 사용
$authHeader = @{ "Content-Type" = "application/json" }
$tokenBytes = [Text.Encoding]::ASCII.GetBytes("yunchan:ONVI2v4J#y")
$authHeader["Authorization"] = "Basic " + [Convert]::ToBase64String($tokenBytes)
$authHeader = @{
"Content-Type" = "application/json"
"Authorization" = "token $env:FORGEJO_TOKEN"
}
$releaseBody = @{
tag_name = $Tag
@ -260,31 +265,31 @@ $ReleaseNotes
if (Test-Path $innoExe) {
Write-Host " - Inno Setup 표준 설치 파일(Setup-x64.exe) 업로드 중..." -ForegroundColor Gray
curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-$Version-Setup-x64.exe" -F "attachment=@$innoExe" | Out-Null
curl.exe -s -H "Authorization: token $env:FORGEJO_TOKEN" -X POST "$uploadUrl`?name=Everything2Everything-$Version-Setup-x64.exe" -F "attachment=@$innoExe" | Out-Null
Write-Host " -> Inno Setup 설치 파일 업로드 완료!" -ForegroundColor Gray
}
if (Test-Path $portableZip) {
Write-Host " - Portable ZIP 업로드 중..." -ForegroundColor Gray
curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-$Version-win-x64-portable.zip" -F "attachment=@$portableZip" | Out-Null
curl.exe -s -H "Authorization: token $env:FORGEJO_TOKEN" -X POST "$uploadUrl`?name=Everything2Everything-$Version-win-x64-portable.zip" -F "attachment=@$portableZip" | Out-Null
Write-Host " -> Portable ZIP 업로드 완료!" -ForegroundColor Gray
}
if (Test-Path $msixFile) {
Write-Host " - MSIX 패키지 업로드 중..." -ForegroundColor Gray
curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-x64.msix" -F "attachment=@$msixFile" | Out-Null
curl.exe -s -H "Authorization: token $env:FORGEJO_TOKEN" -X POST "$uploadUrl`?name=Everything2Everything-x64.msix" -F "attachment=@$msixFile" | Out-Null
Write-Host " -> MSIX 업로드 완료!" -ForegroundColor Gray
}
if (Test-Path $setupZip) {
Write-Host " - 1-클릭 설치 번들 ZIP 업로드 중..." -ForegroundColor Gray
curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-$Version-Setup.zip" -F "attachment=@$setupZip" | Out-Null
curl.exe -s -H "Authorization: token $env:FORGEJO_TOKEN" -X POST "$uploadUrl`?name=Everything2Everything-$Version-Setup.zip" -F "attachment=@$setupZip" | Out-Null
Write-Host " -> 1-클릭 설치 번들 ZIP 업로드 완료!" -ForegroundColor Gray
}
if (Test-Path $cerFile) {
Write-Host " - 공개 개발자 인증서(.cer) 업로드 중..." -ForegroundColor Gray
curl.exe -s -u "yunchan:ONVI2v4J#y" -X POST "$uploadUrl`?name=Everything2Everything-DevCert.cer" -F "attachment=@$cerFile" | Out-Null
curl.exe -s -H "Authorization: token $env:FORGEJO_TOKEN" -X POST "$uploadUrl`?name=Everything2Everything-DevCert.cer" -F "attachment=@$cerFile" | Out-Null
Write-Host " -> 공개 개발자 인증서 업로드 완료!" -ForegroundColor Gray
}
} catch {