Skip to content

Update deploy-git-ssh-key.yml #2

Update deploy-git-ssh-key.yml

Update deploy-git-ssh-key.yml #2

name: Deploy via SSH by Key
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_KEY }}
- name: Connect and Deploy
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} << 'EOF'
cd ${{ secrets.PROJECT_PATH }}
git fetch origin main
git reset --hard origin/main
git clean -fd
${{ secrets.RESTART_COMMAND }}
EOF