milanmk / actions-file-deployer

Composite GitHub Action (Linux runner) for deploying repository content to remote server. Fast and customizable deployment with proxy support. Deploy only changed files or do full sync/mirror of repository content.
The Unlicense
62 stars 14 forks source link
continuous-deployment deployment-automation ftp-deploy github-actions github-workflow ssh-deploy workflow-automation

FTP/SFTP file deployer

Fast and customizable deployment with parallel connections and proxy support. Deploy only changed files or do full sync/mirror of repository content.

This is a composite GitHub Action (Linux runner) for deploying repository content to remote server.

Features

Workflow screenshot

Usage

- name: "Checkout"
  uses: actions/checkout@v4
  with:
    fetch-depth: 0
- name: "Deploy"
  uses: milanmk/actions-file-deployer@master
  with:
    remote-protocol: "sftp"
    remote-host: "ftp.example.com"
    remote-user: "username"
    ssh-private-key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
    remote-path: "/var/www/example.com"

Workflow example .github/workflows/main.yml.

name: Deploy Files

on:
  push:
    branches:
      - master
  # Enables manually triggering of Workflow with file synchronization option
  workflow_dispatch:
    inputs:
      sync:
        description: "File synchronization"
        required: true
        default: "delta"

jobs:
  deploy-master:
    name: "master branch"
    if: ${{ github.ref == 'refs/heads/master' }}
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - name: "Checkout"
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - name: "Deploy"
        uses: milanmk/actions-file-deployer@master
        with:
          remote-protocol: "sftp"
          remote-host: "ftp.example.com"
          remote-user: "username"
          ssh-private-key: ${{ secrets.DEPLOY_PRIVATE_KEY }}
          remote-path: "/var/www/example.com"

Inputs

Name Required Default Description
remote-protocol yes sftp Remote file transfer protocol (ftp, sftp)
remote-host yes Remote host
remote-port yes 22 Remote port
remote-user yes FTP/SSH username
remote-password no FTP/SSH password
ssh-private-key no SSH private key of user
proxy yes false Enable proxy for FTP connection (true, false)
proxy-host yes (if proxy: true) Proxy host
proxy-port yes (if proxy: true) 22 Proxy port
proxy-forwarding-port yes (if proxy: true) 1080 Proxy forwarding port
proxy-user yes (if proxy: true) Proxy username
proxy-private-key yes (if proxy: true) Proxy SSH private key of user
local-path yes . Local path to repository
remote-path yes . Remote path on host
sync yes delta File synchronization (delta, full)
sync-delta-excludes no Files to exclude from delta sync
ssh-options no Additional arguments for SSH client
ftp-options no Additional arguments for FTP client
ftp-mirror-options no Additional arguments for mirroring
ftp-post-sync-commands no Additionnal FTP command to run after sync
webhook no Send webhook event notifications
artifacts no false Upload logs/files to artifacts (true, false)
debug no false Enable debug information (true, false)

Notes

Planned features