Files
rmtPocketWatcher/flutter_app/encode_certificate.ps1
HRiggs 110c5d99a1
Some checks failed
Flutter Release / get-version (push) Successful in 7s
Flutter Release / build-windows (push) Failing after 9s
Flutter Release / create-release (push) Has been cancelled
Flutter Release / build-android (push) Has been cancelled
Signing, Installer, New Workflows
2025-12-15 00:05:29 -05:00

37 lines
1.5 KiB
PowerShell

# Encode Certificate for CI/CD
# Converts the PFX certificate to base64 for use as GitHub/Gitea action secret
param(
[string]$CertPath = "certificates\rmtPocketWatcher.pfx",
[string]$OutputFile = "certificate_base64.txt"
)
$ErrorActionPreference = "Stop"
Write-Host "Encoding Certificate for CI/CD" -ForegroundColor Green
Write-Host "==============================" -ForegroundColor Green
# Check if certificate exists
if (-not (Test-Path $CertPath)) {
Write-Error "Certificate not found at: $CertPath"
Write-Host "Create a certificate first using .\create_certificate.ps1" -ForegroundColor Yellow
exit 1
}
# Read certificate and encode as base64
Write-Host "Reading certificate: $CertPath" -ForegroundColor Yellow
$certBytes = [System.IO.File]::ReadAllBytes((Resolve-Path $CertPath))
$certBase64 = [System.Convert]::ToBase64String($certBytes)
# Save to file
$certBase64 | Out-File -FilePath $OutputFile -Encoding ASCII -NoNewline
Write-Host "✅ Certificate encoded successfully!" -ForegroundColor Green
Write-Host "Base64 encoded certificate saved to: $OutputFile" -ForegroundColor Cyan
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Yellow
Write-Host "1. Copy the contents of $OutputFile" -ForegroundColor White
Write-Host "2. Add as action secret named 'CERT_BASE64'" -ForegroundColor White
Write-Host "3. Add certificate password as secret named 'CERT_PASSWORD'" -ForegroundColor White
Write-Host ""
Write-Host "⚠️ IMPORTANT: Delete $OutputFile after copying to keep certificate secure!" -ForegroundColor Red