Skip to content

Releases: Lexty/ssh-sync-action

v1.0.0: SSH Sync Action - Execute SSH commands and bidirectional file transfers

22 Mar 19:01
e6b3b33

Choose a tag to compare

SSH Sync Action v1.0.0

This GitHub Action provides a complete solution for executing SSH commands and transferring files bidirectionally between your workflow and remote servers.

Key Features

  • Bidirectional File Transfers: Upload and download files using either rsync or scp
  • SSH Command Execution: Run commands before and after file transfers
  • Multiple Transfer Methods: Choose between rsync (efficient) or scp (widely available)
  • Flexible Authentication: Support for both SSH key and password authentication
  • Extensive Testing: Comprehensive test suite ensures reliability

Usage

- name: Deploy and sync files
  uses: yourusername/ssh-sync-action@v1
  with:
    host: ${{ secrets.REMOTE_HOST }}
    user: ${{ secrets.REMOTE_USER }}
    key: ${{ secrets.SSH_PRIVATE_KEY }}
    
    # Initial setup commands
    first_ssh: |
      mkdir -p /app/public
      systemctl stop myapp
    
    # Upload app code with rsync
    rsync_upload: |
      './dist/*' => /app/public/
      ./assets/ => /app/public/assets/
    
    # Download logs from the server
    scp_download: |
      /var/log/myapp/* => ./logs/
    
    # Finalize deployment
    last_ssh: |
      chown -R www-data:www-data /app
      systemctl start myapp

Installation

To use this action in your workflow:

  1. Add the action to your workflow file:

    uses: yourusername/ssh-sync-action@v1
  2. Configure the required inputs (host, user, and either key or pass)

  3. Add your file transfer configurations and optional SSH commands

For more details, examples and advanced usage, please check the [README](https://github.com/yourusername/ssh-sync-action/blob/main/README.md).

Requirements

  • For rsync: The remote server must have rsync installed
  • For SSH key authentication: The private key must be provided via the key input
  • For password authentication: The password must be provided via the pass input