π deploy verbose #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy PHP App | |
on: | |
push: | |
branches: | |
- release # Deploy only when code is pushed to the release branch | |
jobs: | |
deploy: | |
name: Deploy to Server | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: Setup SSH for rsync | |
uses: webfactory/ssh-agent@v0.5.4 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
- name: Add server to known hosts | |
run: | | |
mkdir -p ~/.ssh | |
ssh-keyscan -H ${{ secrets.HOST }} >> ~/.ssh/known_hosts | |
chmod 644 ~/.ssh/known_hosts | |
- name: Test SSH connection | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.USERNAME }}@${{ secrets.HOST }} "echo 'SSH connection successful'" | |
- name: Sync files to server | |
run: | | |
rsync -avz --delete --exclude="assets" ./ ${{ secrets.USERNAME }}@${{ secrets.HOST }}:/srv/data/web/vhosts/partez.net/htdocs/ -v |