39 lines
1.1 KiB
YAML
39 lines
1.1 KiB
YAML
name: Deploy to Production
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" | tr -d '\r' > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null || true
|
|
|
|
- name: Deploy to Production Server
|
|
run: |
|
|
echo "🚀 Deploying to Production..."
|
|
rsync -avz --delete \
|
|
--exclude=".git/" \
|
|
--exclude=".gitea/" \
|
|
--exclude=".gitignore" \
|
|
--exclude="designs/" \
|
|
-e "ssh -p ${SSH_PORT} -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no" \
|
|
./ \
|
|
${SSH_USER}@${SSH_HOST}:${TARGET_DIR}
|
|
env:
|
|
SSH_PORT: ${{ secrets.SSH_PORT }}
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
TARGET_DIR: ${{ secrets.TARGET_DIR }}
|