Redesign deploy.yml: Use SCP to transfer release package to server
ci / backend (push) Failing after 1s
ci / static (push) Failing after 8s
Build & Test with Secrets / build (push) Failing after 1s
ci / frontend (push) Failing after 21s
Build & Test with Secrets / security-scan (push) Failing after 6s
ci / publish (push) Has been skipped
Build & Test with Secrets / frontend (push) Failing after 1m20s
Build & Test with Secrets / notification (push) Failing after 2s
deploy / deploy (push) Failing after 1m54s
deploy / notify (push) Successful in 1s
ci / backend (push) Failing after 1s
ci / static (push) Failing after 8s
Build & Test with Secrets / build (push) Failing after 1s
ci / frontend (push) Failing after 21s
Build & Test with Secrets / security-scan (push) Failing after 6s
ci / publish (push) Has been skipped
Build & Test with Secrets / frontend (push) Failing after 1m20s
Build & Test with Secrets / notification (push) Failing after 2s
deploy / deploy (push) Failing after 1m54s
deploy / notify (push) Successful in 1s
Changed approach: - Build Release package locally (zip) - Transfer via SCP (requires SSH key) - Manual unzip and service restart on server Requires DEPLOY_KEY secret (SSH private key) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
+29
-37
@@ -31,49 +31,41 @@ jobs:
|
||||
dotnet publish -c Release -o ./publish src/KArtSell.Host
|
||||
dotnet publish -c Release -o ./publish src/KArtSell.DbMigrator
|
||||
|
||||
- name: Deploy to Gitea server (local filesystem)
|
||||
env:
|
||||
KARTSELL_POSTGRES: ${{ secrets.KARTSELL_POSTGRES }}
|
||||
KRX_OPENAPI: ${{ secrets.KRX_OPENAPI }}
|
||||
OPENDART_API: ${{ secrets.OPENDART_API }}
|
||||
KIS_APP_KEY: ${{ secrets.KIS_APP_KEY }}
|
||||
KIS_APP_SECRET: ${{ secrets.KIS_APP_SECRET }}
|
||||
- name: Create deployment package
|
||||
run: |
|
||||
# Gitea 서버 동일 파일시스템으로 배포
|
||||
DEPLOY_PATH="/app/kartsell"
|
||||
cd ./publish
|
||||
zip -r ../kartsell-release.zip .
|
||||
cd ..
|
||||
ls -lh kartsell-release.zip
|
||||
|
||||
echo "📦 Deploying to $DEPLOY_PATH..."
|
||||
- name: Deploy via SCP to server
|
||||
env:
|
||||
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
|
||||
run: |
|
||||
# SSH 키 설정 (SSH_KEY에서 변환)
|
||||
echo "$DEPLOY_KEY" > /tmp/deploy_key.pem
|
||||
chmod 600 /tmp/deploy_key.pem
|
||||
|
||||
# 배포 디렉토리 생성 (sudo 사용)
|
||||
if [ ! -d "$DEPLOY_PATH" ]; then
|
||||
sudo mkdir -p "$DEPLOY_PATH"
|
||||
sudo chown -R $USER:$USER "$DEPLOY_PATH"
|
||||
echo "✅ Created $DEPLOY_PATH"
|
||||
fi
|
||||
# 서버에 파일 전송
|
||||
echo "📦 Deploying kartsell-release.zip to server..."
|
||||
scp -i /tmp/deploy_key.pem -o StrictHostKeyChecking=no \
|
||||
./kartsell-release.zip kjh2064@178.104.200.7:/tmp/
|
||||
|
||||
# 기존 백업
|
||||
if [ -d "$DEPLOY_PATH/current" ]; then
|
||||
BACKUP_DIR="$DEPLOY_PATH/backup-$(date +%s)"
|
||||
sudo mv "$DEPLOY_PATH/current" "$BACKUP_DIR"
|
||||
echo "✅ Backed up previous version to $BACKUP_DIR"
|
||||
fi
|
||||
|
||||
# 새 버전 배포
|
||||
sudo cp -r ./publish "$DEPLOY_PATH/current"
|
||||
sudo chown -R $USER:$USER "$DEPLOY_PATH/current"
|
||||
sudo chmod +x "$DEPLOY_PATH/current/KArtSell.Host"
|
||||
|
||||
echo "✅ Files deployed successfully"
|
||||
|
||||
echo "✅ Release build deployed to $DEPLOY_PATH/current"
|
||||
echo "✅ File transferred"
|
||||
echo ""
|
||||
echo "📋 Next steps on server:"
|
||||
echo " 1. SSH: ssh kjh2064@178.104.200.7"
|
||||
echo " 2. Migrate: cd $DEPLOY_PATH/current && export KARTSELL_POSTGRES='$KARTSELL_POSTGRES' && dotnet KArtSell.DbMigrator.dll"
|
||||
echo " 3. Restart: sudo systemctl restart kartsell"
|
||||
echo " 4. Check: curl https://kartsell.taxbaik.com/"
|
||||
echo "📋 Next steps on server (run these):"
|
||||
echo " ssh kjh2064@178.104.200.7"
|
||||
echo " sudo rm -rf /app/kartsell/current"
|
||||
echo " sudo mkdir -p /app/kartsell"
|
||||
echo " cd /app/kartsell && sudo unzip /tmp/kartsell-release.zip"
|
||||
echo " export KARTSELL_POSTGRES='${{ secrets.KARTSELL_POSTGRES }}'"
|
||||
echo " dotnet KArtSell.DbMigrator.dll"
|
||||
echo " sudo systemctl restart kartsell"
|
||||
echo ""
|
||||
echo "✅ Deployment completed"
|
||||
echo "✅ Deployment package ready"
|
||||
|
||||
# Cleanup
|
||||
rm /tmp/deploy_key.pem
|
||||
|
||||
notify:
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user