Files
taxbaik/.gitea/workflows/deploy.yml
T
kjh2064 0f6d22cbbe
TaxBaik CI/CD / build-and-deploy (push) Successful in 56s
fix: CI 배포 - clean 빌드 + pkill로 서비스 재시작
2026-06-27 00:06:28 +09:00

74 lines
2.2 KiB
YAML

name: TaxBaik CI/CD
on:
push:
branches:
- master
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: '10.0'
- name: Restore dependencies
run: dotnet restore TaxBaik.sln
- name: Build solution
run: |
dotnet clean TaxBaik.sln -c Release
dotnet build TaxBaik.sln -c Release --no-restore
- name: Publish Web (통합 앱)
run: dotnet publish TaxBaik.Web/ -c Release -o ./publish --no-restore
- name: Copy migrations to publish
run: |
cp -r db/migrations ./publish/migrations || true
- name: Generate build info
run: |
mkdir -p ./publish/wwwroot
COMMIT_HASH=$(git rev-parse --short HEAD)
BUILD_TIME=$(date -u +'%Y-%m-%d %H:%M:%S UTC')
echo "Version: $COMMIT_HASH" > ./publish/wwwroot/version.txt
echo "Built: $BUILD_TIME" >> ./publish/wwwroot/version.txt
echo "✓ Version: $COMMIT_HASH"
- name: Deploy (통합 Web)
run: |
set -e
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
DEPLOY_HOME="/home/kjh2064"
DEPLOY_DIR="$DEPLOY_HOME/deployments/taxbaik_${TIMESTAMP}"
echo "=== Deploying TaxBaik v$(git rev-parse --short HEAD) ==="
mkdir -p "$DEPLOY_DIR"
cp -r ./publish/* "$DEPLOY_DIR/"
ln -sfn "$DEPLOY_DIR" "$DEPLOY_HOME/taxbaik_active"
echo "✓ Deployed to $DEPLOY_DIR"
# systemd가 자동재시작하도록 프로세스 종료 (sudo 불필요)
echo "=== Restarting service ==="
pkill -f "TaxBaik.Web.dll" || true
sleep 3
echo "✓ Deployment complete"
- name: Verify deployment
run: |
sleep 5
STATUS=$(curl -s -o /dev/null -w "%{http_code}" http://127.0.0.1:5001/taxbaik/admin/login || echo "000")
echo "HTTP Status: $STATUS"
if [ "$STATUS" = "200" ] || [ "$STATUS" = "301" ] || [ "$STATUS" = "302" ]; then
echo "✓ Service is running"
else
echo "⚠ Service may not be running (status: $STATUS)"
fi