fixes
This commit is contained in:
parent
d5a66c0eb2
commit
fdf3aea2e3
1 changed files with 87 additions and 0 deletions
87
.forgejo/workflows/deploy-admin.yaml
Normal file
87
.forgejo/workflows/deploy-admin.yaml
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
name: Deploy Admin Panel
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- 'mnemo_cards_admin/**'
|
||||
|
||||
jobs:
|
||||
deploy-admin:
|
||||
name: Deploy Admin Panel
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
apt-get update && apt-get install -y rsync openssh-client
|
||||
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Build Admin Panel
|
||||
run: |
|
||||
echo "🔨 Building admin panel..."
|
||||
cd mnemo_cards_admin/web
|
||||
npm install
|
||||
npm run build
|
||||
echo "✅ Admin panel built successfully"
|
||||
|
||||
- name: Deploy Admin Panel
|
||||
run: |
|
||||
echo "🚀 Deploying admin panel..."
|
||||
cd tools/deploy/admin
|
||||
./deploy.sh
|
||||
|
||||
verification:
|
||||
name: Admin Panel Verification
|
||||
runs-on: ubuntu-latest
|
||||
needs: deploy-admin
|
||||
if: always()
|
||||
steps:
|
||||
- name: Setup SSH
|
||||
run: |
|
||||
mkdir -p ~/.ssh
|
||||
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_rsa
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
|
||||
|
||||
- name: Verify Admin Panel
|
||||
run: |
|
||||
echo "🔍 Verifying admin panel deployment..."
|
||||
ssh -o ServerAliveInterval=60 -o ServerAliveCountMax=3 -o ConnectTimeout=30 -o StrictHostKeyChecking=no ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'ENDSSH'
|
||||
set -e
|
||||
|
||||
# Check nginx status
|
||||
if sudo systemctl is-active --quiet nginx; then
|
||||
echo "✅ nginx: работает"
|
||||
else
|
||||
echo "❌ nginx: НЕ работает!"
|
||||
sudo systemctl status nginx --no-pager || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test admin panel accessibility
|
||||
if curl -I --max-time 10 https://admin.mnemo-cards.online/ 2>/dev/null | grep -q "200\|301\|302"; then
|
||||
echo "✅ admin.mnemo-cards.online доступен"
|
||||
else
|
||||
echo "❌ admin.mnemo-cards.online НЕДОСТУПЕН!"
|
||||
curl -I --max-time 5 https://admin.mnemo-cards.online/ || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "🎉 Admin panel verification completed successfully!"
|
||||
ENDSSH
|
||||
Loading…
Reference in a new issue