48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
name: Build and Deploy Frontend via SSH
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
- name: Install SSH key
|
|
uses: webfactory/ssh-agent@v0.9.0
|
|
with:
|
|
ssh-private-key: ${{ secrets.DEPLOY_SSH_KEY }}
|
|
|
|
- name: Debug SSH key
|
|
run: |
|
|
echo "Key content (first 50 chars):"
|
|
head -c 50 ~/.ssh/id_ed25519
|
|
echo ""
|
|
echo "Key permissions:"
|
|
ls -la ~/.ssh/id_ed25519
|
|
|
|
- name: Deploy via SCP
|
|
run: |
|
|
tar -czf frontend.tar.gz -C dist .
|
|
scp -o StrictHostKeyChecking=no frontend.tar.gz ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }}:/tmp/
|
|
ssh -o StrictHostKeyChecking=no ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << 'EOF'
|
|
mkdir -p /opt/uvpn.shop/frontend
|
|
rm -rf /opt/uvpn.shop/frontend/*
|
|
tar -xzf /tmp/frontend.tar.gz -C /opt/uvpn.shop/frontend
|
|
rm /tmp/frontend.tar.gz
|
|
EOF |