Skip to content

Github deploy scp

Actions
Github Action to deploy code on a remote server via scp
v1
Latest
Star (0)

Tags

 (1)

github-deploy

Github Action providing simple scp feature

Examples

Copy a single file

- name: Copy single file
  uses: dj-256/github-deploy@v1
  with:
    local: main.py
    remote: /home/user/example
    host: ${{ secrets.HOST }}
    port: ${{ secrets.PORT }}
    username: ${{ secrets.USERNAME }}
    password: ${{ secrets.PASSWORD }}

Copy a directory recursively

- name: Copy entire directory
  uses: dj-256/github-deploy@v1
  with:
    local: ./dist
    remote: /var/www/app
    host: ${{ secrets.HOST }}
    username: ${{ secrets.SSH_USER }}
    password: ${{ secrets.PASSWORD }}

Copy a directory excluding some files

- name: Excluding JS files
  uses: dj-256/github-deploy@v1
  with:
      local: dist
      remote: /home/example/
      host: ${{ secrets.HOST }}
      username: ${{ secrets.SSH_USER }}
      password: ${{ secrets.PASSWORD }}
      exclude: '*.js'

Copy a directory excluding a subdirectory

- name: Copy exluding subdirectory
  uses: dj-256/github-deploy@v1
  with:
      local: ./
      remote: /var/www/dir
      host: ${{ secrets.HOST }}
      username: ${{ secrets.SSH_USER }}
      password: ${{ secrets.PASSWORD }}
      port: ${{ secrets.SSH_PORT }}
      exclude: 'out'

Options

  • local - string - Path to the local file or directory you want to copy, relative to repository root. required

  • remote - string - Path to the remote directory to copy the contents to, absolute. required

  • host - string - Hostname or IP address of the server. Default: 'localhost'

  • port - integer - Port number of the server. Default: 22

  • username - string - Username for authentication. Default: (none)

  • password - string - Password for password-based user authentication. Default: (none)

  • passphrase - string - For an encrypted private key, this is the passphrase used to decrypt it. Default: (none)

  • rmRemote - boolean - Clean directory before uploading. Default: false

  • exclude - string - Paths excluded from the copy, relative to remote path. You can specify a single file or directory or else, use a glob.

Development

This has been strongly inspired by garygrossgarten's github-action-scp it uses node-scp and glob

Github deploy scp is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Github Action to deploy code on a remote server via scp
v1
Latest

Tags

 (1)

Github deploy scp is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.