8000 Create deploy-git-ssh-password.yml · BaseMax/github-actions-ssh-git-pull@7ab4e23 · GitHub
[go: up one dir, main page]

Skip to content

Create deploy-git-ssh-password.yml #3

Create deploy-git-ssh-password.yml

Create deploy-git-ssh-password.yml #3

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/ssh-agent@v0.9.0
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
0