### 버전 정보 표시 기능 - CI/CD에서 빌드 시간과 git commit hash를 version.txt에 기록 - Web과 Admin 앱이 시작 시 version.txt를 읽어 VersionInfo 싱글톤으로 등록 - 홈페이지 푸터에 "버전: <커밋해시> | 배포: <빌드시간>" 표시 - 최신 소스 반영 여부를 즉시 확인 가능 ### 포트 충돌 해결 - 배포 후 기존 프로세스 종료 시 포트 릴리스 대기 로직 추가 - lsof 명령으로 포트 사용 여부 확인 (최대 30초 대기) - 5001/5002 포트가 완전히 릴리스될 때까지 new process 시작 지연 - "Address already in use" 오류 해결 파일 변경: - .gitea/workflows/deploy.yml: 버전 파일 생성 + 포트 대기 로직 - TaxBaik.Web/Program.cs: version.txt 읽기 + VersionInfo 등록 - TaxBaik.Admin/Program.cs: version.txt 읽기 + VersionInfo 등록 - TaxBaik.Web/Pages/Shared/_Footer.cshtml: 버전 정보 표시 - TaxBaik.Web/VersionInfo.cs: 새로 추가 - TaxBaik.Admin/VersionInfo.cs: 새로 추가 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,21 @@ jobs:
|
||||
cp -r db/migrations ./publish/web/migrations || true
|
||||
cp -r db/migrations ./publish/admin/migrations || true
|
||||
|
||||
- name: Generate build info
|
||||
run: |
|
||||
COMMIT_HASH=$(git rev-parse --short HEAD)
|
||||
BUILD_TIME=$(date -u +'%Y-%m-%d %H:%M:%S UTC')
|
||||
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
|
||||
echo "BUILD_TIME=$BUILD_TIME" >> $GITHUB_ENV
|
||||
cat > ./publish/web/wwwroot/version.txt <<EOF
|
||||
Version: $COMMIT_HASH
|
||||
Built: $BUILD_TIME
|
||||
EOF
|
||||
cat > ./publish/admin/wwwroot/version.txt <<EOF
|
||||
Version: $COMMIT_HASH
|
||||
Built: $BUILD_TIME
|
||||
EOF
|
||||
|
||||
- name: Setup SSH key
|
||||
uses: webfactory/ssh-agent@v0.9.0
|
||||
with:
|
||||
@@ -53,7 +68,13 @@ jobs:
|
||||
tar -xzf /tmp/web_publish.tar.gz -C "$WEB_DEPLOY_DIR"
|
||||
ln -sfn "$WEB_DEPLOY_DIR/web" ~/taxbaik_active
|
||||
pkill -f "TaxBaik.Web" || true
|
||||
sleep 2
|
||||
# Wait for port 5001 to be released
|
||||
for i in {1..30}; do
|
||||
if ! lsof -Pi :5001 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
cd ~/taxbaik_active
|
||||
export ConnectionStrings__Default="Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=taxbaik123"
|
||||
export ASPNETCORE_ENVIRONMENT=Production
|
||||
@@ -73,7 +94,13 @@ jobs:
|
||||
tar -xzf /tmp/admin_publish.tar.gz -C "$ADMIN_DEPLOY_DIR"
|
||||
ln -sfn "$ADMIN_DEPLOY_DIR/admin" ~/taxbaik_admin_active
|
||||
pkill -f "TaxBaik.Admin" || true
|
||||
sleep 2
|
||||
# Wait for port 5002 to be released
|
||||
for i in {1..30}; do
|
||||
if ! lsof -Pi :5002 -sTCP:LISTEN -t >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
cd ~/taxbaik_admin_active
|
||||
export ConnectionStrings__Default="Host=localhost;Database=taxbaikdb;Username=taxbaik;Password=taxbaik123"
|
||||
export ASPNETCORE_ENVIRONMENT=Production
|
||||
|
||||
@@ -20,6 +20,22 @@ builder.Services.AddMemoryCache();
|
||||
builder.Services.AddInfrastructure();
|
||||
builder.Services.AddApplication();
|
||||
|
||||
// Register version info
|
||||
var versionInfo = new VersionInfo();
|
||||
var versionFilePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "version.txt");
|
||||
if (File.Exists(versionFilePath))
|
||||
{
|
||||
var lines = File.ReadAllLines(versionFilePath);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.StartsWith("Version:"))
|
||||
versionInfo.Version = line.Substring("Version:".Length).Trim();
|
||||
else if (line.StartsWith("Built:"))
|
||||
versionInfo.Built = line.Substring("Built:".Length).Trim();
|
||||
}
|
||||
}
|
||||
builder.Services.AddSingleton(versionInfo);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Run migrations on startup
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace TaxBaik.Admin;
|
||||
|
||||
public class VersionInfo
|
||||
{
|
||||
public string Version { get; set; } = "unknown";
|
||||
public string Built { get; set; } = "unknown";
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
@inject VersionInfo VersionInfo
|
||||
|
||||
<footer class="bg-light border-top mt-5 py-4">
|
||||
<div class="container">
|
||||
<div class="row g-4">
|
||||
@@ -28,6 +30,9 @@
|
||||
<p>© 2026 백원숙 세무회계. All rights reserved.</p>
|
||||
<a href="/taxbaik/privacy" class="text-decoration-none text-muted me-2">개인정보처리방침</a>
|
||||
<a href="/taxbaik/terms" class="text-decoration-none text-muted">이용약관</a>
|
||||
<div class="mt-2" style="font-size: 0.75rem; opacity: 0.7;">
|
||||
🔄 버전: @VersionInfo.Version | 배포: @VersionInfo.Built
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -13,6 +13,22 @@ builder.Services.AddResponseCompression(opts => {
|
||||
builder.Services.AddInfrastructure();
|
||||
builder.Services.AddApplication();
|
||||
|
||||
// Register version info
|
||||
var versionInfo = new VersionInfo();
|
||||
var versionFilePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "version.txt");
|
||||
if (File.Exists(versionFilePath))
|
||||
{
|
||||
var lines = File.ReadAllLines(versionFilePath);
|
||||
foreach (var line in lines)
|
||||
{
|
||||
if (line.StartsWith("Version:"))
|
||||
versionInfo.Version = line.Substring("Version:".Length).Trim();
|
||||
else if (line.StartsWith("Built:"))
|
||||
versionInfo.Built = line.Substring("Built:".Length).Trim();
|
||||
}
|
||||
}
|
||||
builder.Services.AddSingleton(versionInfo);
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
// Run migrations on startup
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
namespace TaxBaik.Web;
|
||||
|
||||
public class VersionInfo
|
||||
{
|
||||
public string Version { get; set; } = "unknown";
|
||||
public string Built { get; set; } = "unknown";
|
||||
}
|
||||
Reference in New Issue
Block a user